:root {
  --bg: #f5f5f7;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --card: #ffffff;
  --border: #e5e5ea;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.45;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}
.status {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.muted { color: var(--muted); }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { background: #b0b0b5; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}
.btn-link:hover { color: var(--fg); text-decoration: underline; }

.filters {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 24px;
}
.filters input,
.filters select {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filters input:focus,
.filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,0.15);
}
.filters input { flex: 1; }
.filters select { min-width: 200px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding-bottom: 32px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.card-img {
  aspect-ratio: 1 / 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.card-img.placeholder {
  color: var(--muted);
  font-size: 12px;
}

.card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-codigo {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.card-descricao {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.card-marca { font-weight: 500; color: var(--fg); }

.paginacao {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 48px;
}
.paginacao button {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.paginacao button:disabled { opacity: 0.4; cursor: not-allowed; }
.paginacao .info { color: var(--muted); padding: 0 12px; }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1d1d1f;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 14px;
  z-index: 100;
  transition: opacity 0.2s;
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.erro { background: #c0392b; }
.toast.ok { background: #27ae60; }
