/* ============================================
   COMPRA ESPERTA — Mobile First (v3)
   Filosofia: limpo, claro, economia em destaque
   ============================================ */

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --danger: #dc2626;
  --savings: #059669;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: 90px;
}

/* ========== HEADER ========== */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.auth-link {
  color: var(--text-muted);
  text-decoration: none;
}

.auth-link:active {
  color: var(--primary);
}

.auth-sep {
  color: var(--border);
}

.header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.location-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f1f5f9;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
}

.month-savings {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.month-savings strong {
  color: var(--savings);
  font-weight: 600;
}

/* ========== MAIN ========== */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.hero {
  text-align: center;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.hero p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========== MERCADOS ========== */
.markets-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.markets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.markets-header .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.markets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.market-chip {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.market-chip input {
  display: none;
}

.market-chip.active {
  background: #dcfce7;
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ========== INPUT ========== */
.input-area {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

#item-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 1rem;
  outline: none;
  background: #fff;
}

#item-input:focus {
  border-color: var(--primary);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-voice {
  background: #f1f5f9;
  color: var(--text);
  min-width: 46px;
  padding: 11px;
}

.btn-voice svg {
  display: block;
}

.btn-voice.listening {
  background: #fee2e2;
  color: var(--danger);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-compare {
  width: 100%;
  padding: 13px;
  font-size: 1rem;
  margin-top: 6px;
}

/* ========== LISTA DE ITENS ========== */
.item-list {
  list-style: none;
}

.item-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.item-list li:last-child {
  border-bottom: none;
}

.item-name {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.98rem;
}

.item-qty {
  font-weight: 600;
  min-width: 1.1em;
}

.item-x {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.item-product {
  font-weight: 500;
  text-transform: capitalize;
}

.qty-control {
  display: flex;
  gap: 4px;
  opacity: 0.5;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: white;
  font-size: 1rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0.65;
}

.empty-state {
  text-align: center;
  padding: 18px 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ========== TABELA DE RESULTADOS ========== */
.results-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 640px; /* força lado a lado: produto + 2 mercados */
}

.compare-table th,
.compare-table td {
  padding: 10px 12px;
  text-align: right;
  white-space: normal;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  min-width: 180px;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 2;
  font-weight: 500;
  min-width: 120px;
  max-width: 160px;
}

.compare-table thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}

.compare-table thead th:first-child {
  background: #f8fafc;
}

.compare-table .price-best {
  color: var(--primary-dark);
  font-weight: 700;
  background: #f0fdf4;
}

.compare-table .best-mark {
  font-size: 0.7rem;
  color: var(--primary);
  margin-left: 2px;
}

.compare-table tfoot td {
  font-weight: 600;
  background: #f8fafc;
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.compare-table tfoot td:first-child {
  background: #f8fafc;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Bloco de economia (fora da tabela) */
.smart-block {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.smart-total {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.smart-total span {
  color: var(--primary-dark);
}

.smart-save {
  font-size: 0.92rem;
  color: var(--savings);
  font-weight: 600;
  margin-top: 4px;
}

.smart-one-market {
  font-size: 0.95rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.smart-ce-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid #86efac;
  border-radius: 10px;
  background: #f0fdf4;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.35;
}

.smart-ce-btn:hover {
  background: #dcfce7;
}

.smart-ce-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.smart-detail {
  margin-top: 10px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.smart-detail-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.smart-detail-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 0.85rem;
}

.smart-detail-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.smart-detail-list li:last-child {
  border-bottom: none;
}

.sd-item {
  text-transform: capitalize;
  color: var(--text-muted);
}

.smart-detail-total {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
}

.loading {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  background: var(--card);
  border-radius: var(--radius);
}

/* ========== CARRINHO ========== */
.cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
  max-width: 640px;
  margin: 0 auto;
}

.cart-thumbs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}

.cart-thumbs::-webkit-scrollbar { display: none; }

.thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.thumb-letter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.thumb .qty-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: white;
  font-size: 0.6rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-info {
  text-align: right;
  min-width: 95px;
}

.cart-total {
  font-weight: 700;
  font-size: 1rem;
}

.cart-savings {
  font-size: 0.78rem;
  color: var(--savings);
  font-weight: 600;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  background: white;
  width: 100%;
  max-width: 640px;
  border-radius: 16px 16px 0 0;
  padding: 20px;
}

.modal h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.city-list {
  list-style: none;
}

.city-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 1rem;
}

.city-list li:active {
  background: #f1f5f9;
}

.hidden {
  display: none !important;
}

/* ========== AUTH (login na mesma página) ========== */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.modal-head h3 {
  margin-bottom: 0;
}

.modal-close {
  border: none;
  background: #f1f5f9;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close:active {
  background: var(--border);
}

.auth-modal {
  max-height: min(88dvh, 720px);
  overflow-y: auto;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.auth-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label,
.key-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.auth-form input,
.auth-form textarea,
.key-label input,
.auth-upload textarea {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-upload textarea:focus {
  outline: 2px solid rgba(22, 163, 74, 0.25);
  border-color: var(--primary);
}

.btn-block {
  width: 100%;
  margin-top: 4px;
}

.btn-ghost {
  background: #f1f5f9;
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-ghost:active {
  background: var(--border);
}

.auth-msg {
  min-height: 1.2em;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.auth-msg.error {
  color: var(--danger);
}

.auth-msg.ok {
  color: var(--savings);
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-tab.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.auth-logged {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.auth-ok {
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.auth-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

.auth-lists {
  font-size: 0.85rem;
}

.btn-logout-sm {
  display: block;
  margin: 4px 0 10px;
  padding: 2px 0;
  background: none;
  border: none;
  color: #dc2626;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-logout-sm:hover {
  text-decoration: underline;
}

.btn-favoritar {
  background: none;
  border: 1px solid #e2c14a;
  color: #92702a;
  border-radius: 6px;
  font-size: 0.75rem;
  padding: 2px 8px;
  cursor: pointer;
  margin-top: 4px;
}

.btn-favoritar:hover {
  background: #fff7e0;
}

.auth-list-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f8fafc;
}

.auth-list-card strong {
  display: block;
  margin-bottom: 4px;
}

.auth-list-card button {
  margin-top: 6px;
  font-size: 0.8rem;
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.auth-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}

.auth-kpi {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.auth-kpi b {
  display: block;
  font-size: 1.15rem;
  color: var(--primary-dark);
}

.auth-kpi span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.auth-upload h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.auth-upload textarea {
  width: 100%;
  resize: vertical;
  margin-bottom: 8px;
  min-height: 100px;
}

.auth-link.logged {
  color: var(--primary-dark);
  font-weight: 600;
}

.xlsx-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
  transition: border-color 0.15s, background 0.15s;
}

.xlsx-drop:hover,
.xlsx-drop.xlsx-drop-over {
  border-color: var(--primary);
  background: rgba(22, 163, 74, 0.06);
}

.xlsx-manual {
  margin: 4px 0 8px;
  font-size: 0.85rem;
}

.xlsx-manual summary {
  cursor: pointer;
  color: var(--text-muted, #64748b);
}

.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: 16px;
    margin: 16px;
  }
}

/* ========== P1: opções lado a lado (sem dropdown) ========== */
.cell-option {
  text-align: left !important;
  min-width: 200px;
  max-width: 280px;
  vertical-align: top;
}

.opt-current {
  margin-bottom: 8px;
}

.opt-current-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.price-best .opt-current-price {
  color: var(--primary-dark);
}

.opt-current-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 2px;
  line-height: 1.3;
  white-space: normal;
}

.opt-current-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.opt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.opt-chip {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
}

.opt-chip:hover {
  border-color: #86efac;
  background: #f8fafc;
}

.opt-chip-on {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: inset 0 0 0 1px #86efac;
}

.opt-chip-price {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
}

.opt-chip-name {
  display: block;
  font-size: 0.72rem;
  color: var(--text);
  white-space: normal;
}

.opt-chip-unit {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.cell-empty {
  color: var(--text-muted);
}

.cell-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.prod-label {
  font-weight: 500;
}

.pending-hint {
  font-size: 0.72rem;
  color: #d97706;
  margin-top: 2px;
}

.row-pending td {
  background: #fffbeb;
}

.row-pending td:first-child {
  background: #fffbeb;
}

.pending-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.smart-ce-static {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 0.95rem;
  line-height: 1.35;
}

/* ---- Lista de compras (2ª view) ---- */
.btn-list-mode {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0.5rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  background: #f0fdf4;
  font-size: 0.95rem;
  cursor: pointer;
  color: #14532d;
}
.btn-list-mode:hover { background: #dcfce7; }
.btn-list-smart {
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.list-view { padding-bottom: 2rem; }
.list-view.hidden { display: none; }
.list-view-header { margin-bottom: 1rem; }
.btn-back {
  border: none;
  background: none;
  color: #16a34a;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-bottom: 0.5rem;
}
.list-hint { color: #64748b; font-size: 0.85rem; margin: 0.25rem 0 1rem; }
.list-hint-small { color: #94a3b8; font-size: 0.8rem; margin-top: 0.5rem; }
.shop-group { margin-bottom: 1.25rem; }
.shop-market {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.35rem;
}
.shop-lines { list-style: none; padding: 0; margin: 0; }
.shop-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  user-select: none;
}
.shop-line:active { background: #f8fafc; }
.shop-check { width: 1.4rem; color: #16a34a; flex-shrink: 0; }
.shop-text { flex: 1; font-size: 0.95rem; }
.shop-price { font-size: 0.9rem; color: #475569; }
.shop-line.tachado .shop-text {
  text-decoration: line-through;
  color: #94a3b8;
}
.shop-line.tachado .shop-price { color: #cbd5e1; }
.list-actions { margin-top: 1.25rem; }

.opt-chip-choice {
  outline: 2px solid #16a34a;
  background: #f0fdf4;
}

tr.row-need-click td:first-child {
  box-shadow: inset 3px 0 0 #f59e0b;
  background: #fffbeb;
}
tr.row-need-click .prod-label::after {
  content: " ← clique no produto";
  color: #d97706;
  font-size: 0.75rem;
  font-weight: 500;
}

.smart-label {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0.25rem 0 0.35rem;
  font-weight: 600;
}
.btn-list-best {
  border-color: #16a34a;
  background: #dcfce7;
}
.btn-copy-market {
  margin-top: 0.75rem;
  width: 100%;
}

/* ========== v6: cards mobile ========== */
.cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.item-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.item-card-wait {
  border-color: #fbbf24;
}

.item-card-chosen {
  border-color: #86efac;
}

.item-card-need {
  box-shadow: 0 0 0 2px #f59e0b;
}

.item-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.item-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.title-wait {
  color: #d97706;
}

.title-chosen {
  color: #15803d;
}

.item-card-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.item-card-wait .item-card-status {
  color: #d97706;
  font-weight: 600;
}

.item-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.market-block {
  background: #f8fafc;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
}

.market-block-chosen {
  background: #f0fdf4;
  border-color: #86efac;
}

.market-block-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.market-block-chosen .market-block-name {
  color: #15803d;
}

.market-block-empty-msg {
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 4px 0;
}

.opt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.opt-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.opt-chip:active {
  transform: scale(0.99);
}

.opt-chip-on {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.opt-chip-choice {
  border-color: #16a34a;
  background: #f0fdf4;
  outline: 2px solid #86efac;
}

.opt-chip-mismatch {
  opacity: 0.55;
}

.opt-chip-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.opt-chip-choice .opt-chip-price {
  color: #15803d;
}

.opt-chip-name {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.25;
}

.opt-chip-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.item-card-pending .item-card-head {
  background: #fffbeb;
}

.pending-head .item-card-title {
  color: #d97706;
}

/* lista de compras — item ainda sem escolha */
.item-pending-choice .item-product {
  color: #d97706;
}

.item-chosen .item-product {
  color: #15803d;
}

.smart-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: -4px 0 8px;
}

.smart-hint {
  font-size: 0.8rem;
  color: #d97706;
  margin-top: 8px;
}

.match-hint {
  font-size: 0.78rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.btn-disabled,
.btn-list-mode:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-copy-all {
  width: 100%;
  margin-top: 8px;
}

/* esconde tabela antiga se sobrar markup */
.compare-table { display: none; }

@media (min-width: 720px) {
  .item-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
  }
}

.item-card-notfound {
  border-color: #fca5a5;
}
.notfound-head {
  background: #fef2f2;
}
.notfound-head .item-card-title {
  color: #b91c1c;
}
.notfound-msg {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 8px;
}
.btn-abandon {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #b91c1c;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-abandon:active {
  background: #fef2f2;
}

/* fotos do produto */
.opt-chip-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}
.opt-chip-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  flex-shrink: 0;
}
.opt-chip-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.opt-chip-mismatch {
  opacity: 0.72;
  cursor: pointer;
}
.opt-chip-mismatch:active {
  opacity: 1;
  border-color: #94a3b8;
}
.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}
