:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #ea580c;
  --warning-light: #fed7aa;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .brand { font-size: 1.4rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.5px; }
.navbar .brand span { color: var(--accent); }
.navbar .brand:hover { text-decoration: none; }
@media (prefers-color-scheme: dark) {
  .navbar .brand { color: #fff; }
}
.navbar nav { display: flex; gap: 4px; }
.navbar nav a {
  color: var(--gray-500);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  transition: all .15s;
}
.navbar nav a:hover { color: var(--gray-900); background: var(--gray-100); text-decoration: none; }
.navbar nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.navbar .spacer { flex: 1; }
.navbar .admin-link {
  font-size: .8rem;
  color: var(--gray-400);
  padding: 6px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
}
.navbar .admin-link:hover { color: var(--gray-700); border-color: var(--gray-300); text-decoration: none; }

/* ---- LAYOUT ---- */
.container { max-width: 1280px; margin: 0 auto; padding: 28px 32px; }
.container-narrow { max-width: 960px; margin: 0 auto; padding: 28px 32px; }

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 48px 32px;
  text-align: center;
  margin-bottom: 0;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.hero p { font-size: 1rem; opacity: .85; max-width: 500px; margin: 0 auto 24px; }
.hero .search-inline {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  background: rgba(255,255,255,.15);
  border-radius: 99px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.25);
}
.hero .search-inline input {
  flex: 1;
  padding: 14px 24px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  outline: none;
}
.hero .search-inline input::placeholder { color: rgba(255,255,255,.6); }
.hero .search-inline button {
  padding: 14px 28px;
  border: none;
  background: var(--accent);
  color: var(--gray-900);
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s;
}
.hero .search-inline button:hover { background: #d97706; }

/* ---- FILTER BAR ---- */
.filter-bar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
  padding: 7px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  background: #fff;
  color: var(--gray-700);
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--primary); }
.filter-bar .count { margin-left: auto; font-size: .85rem; color: var(--gray-400); }

/* ---- PRODUCT GRID ---- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.product-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  color: inherit;
  position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.product-card .thumb {
  height: 200px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .no-img { font-size: 3rem; color: var(--gray-300); }
.product-card .category-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,.6);
  color: #fff;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.product-card .pf-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--success);
  color: #fff;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
}
.product-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-card .location { font-size: .78rem; color: var(--gray-400); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.product-card .title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; line-height: 1.3; }
.product-card .items-preview { font-size: .78rem; color: var(--gray-500); margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .price-row { margin-top: auto; display: flex; align-items: end; justify-content: space-between; }
.product-card .min-price { font-size: .72rem; color: var(--gray-400); }
.product-card .min-price s { font-size: .85rem; }
.product-card .est-price { text-align: right; }
.product-card .est-price .label { font-size: .65rem; color: var(--accent); font-weight: 600; text-transform: uppercase; }
.product-card .est-price .value { font-size: 1.2rem; font-weight: 800; color: var(--gray-900); }

/* ---- DETAIL ---- */
.detail-back { margin-bottom: 16px; font-size: .85rem; color: var(--gray-400); }
.detail-back:hover { color: var(--primary); }
.detail-layout { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }
.detail-main { min-width: 0; }
.detail-sidebar { position: sticky; top: 84px; align-self: start; }

.gallery-main { border-radius: var(--radius); overflow: hidden; background: var(--gray-100); margin-bottom: 12px; }
.gallery-main img { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.gallery-main .no-img { height: 300px; display: flex; align-items: center; justify-content: center; font-size: 4rem; color: var(--gray-300); }
.gallery-thumbs { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; }
.gallery-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border .15s; }
.gallery-thumbs img:hover, .gallery-thumbs img.active { border-color: var(--primary); }

.sidebar-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 24px;
  margin-bottom: 16px;
}
.sidebar-card h3 { font-size: .75rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 16px; }
.sidebar-card .price-est {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 4px;
}
.sidebar-card .price-est .currency { font-size: 1rem; font-weight: 600; color: var(--gray-500); }
.sidebar-card .price-min { font-size: .85rem; color: var(--gray-400); margin-bottom: 4px; }
.sidebar-card .price-aval { font-size: .85rem; color: var(--gray-400); margin-bottom: 16px; }
.sidebar-card .markup-info {
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .8rem;
  color: var(--gray-700);
  margin-bottom: 16px;
}
.sidebar-card .markup-info strong { color: var(--accent); }

.info-rows { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; justify-content: space-between; font-size: .85rem; }
.info-row .label { color: var(--gray-400); }
.info-row .val { font-weight: 600; }

.origin-mini {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
}
.origin-mini h3 { color: rgba(255,255,255,.7); }
.origin-mini .edital-link { color: #fff; font-weight: 700; font-size: .95rem; display: block; margin-bottom: 10px; }
.origin-mini .edital-link:hover { text-decoration: underline; }
.origin-mini .info-row .label { color: rgba(255,255,255,.6); }
.origin-mini .info-row .val { color: #fff; }

.section-title { font-size: 1.1rem; font-weight: 700; margin: 24px 0 12px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 20px; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th { text-align: left; padding: 10px 16px; background: var(--gray-50); color: var(--gray-400); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--gray-200); }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
tr:hover td { background: var(--gray-50); }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-yellow { background: var(--accent-light); color: #92400e; }

/* ---- ADMIN ---- */
.admin-navbar {
  background: var(--gray-900);
  color: #fff;
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-navbar .brand { font-size: 1.1rem; font-weight: 700; color: #fff; }
.admin-navbar .brand span { color: var(--accent); }
.admin-navbar .brand:hover { text-decoration: none; }
.admin-navbar nav a {
  color: rgba(255,255,255,.5);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 500;
}
.admin-navbar nav a:hover { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.admin-navbar nav a.active { color: var(--accent); background: rgba(255,255,255,.08); }
.admin-navbar .spacer { flex: 1; }
.admin-navbar .site-link { font-size: .78rem; color: var(--gray-400); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.stat-card .number { font-size: 2rem; font-weight: 800; color: var(--gray-900); }
.stat-card .label { font-size: .72rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.stat-card.accent .number { color: var(--primary); }
.stat-card.warning .number { color: var(--warning); }
.stat-card.success .number { color: var(--success); }

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-accent { background: var(--accent); color: var(--gray-900); }
.btn-accent:hover { background: #d97706; text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-outline { background: transparent; border: 1px solid var(--gray-200); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); text-decoration: none; }

.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--gray-400);
  transition: border-color .2s;
}
.upload-area:hover { border-color: var(--primary); }

.pending-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--gray-100); }
.pending-row:last-child { border: none; }

/* ---- PAGINATION ---- */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 28px; }
.pagination a, .pagination span { padding: 7px 14px; border-radius: var(--radius-sm); font-size: .85rem; border: 1px solid var(--gray-200); color: var(--gray-600); }
.pagination a:hover { background: var(--gray-100); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- FORM ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .78rem; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  background: #fff;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-inline { display: flex; gap: 12px; align-items: end; }
.form-inline .form-group { flex: 1; margin-bottom: 0; }

/* ---- RESULT ROWS ---- */
.result-arrematado td:first-child { border-left: 3px solid var(--success); }
.result-nao_arrematado td:first-child { border-left: 3px solid var(--warning); }
.result-excluido td:first-child { border-left: 3px solid var(--gray-300); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
}
@media (max-width: 768px) {
  .container, .container-narrow { padding: 16px; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 32px 16px; }
  .hero h1 { font-size: 1.5rem; }
  .navbar nav, .admin-navbar nav { display: none; }
  .filter-bar { padding: 12px 16px; }
  .navbar, .admin-navbar { padding: 0 16px; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
}
