:root {
  --accent: #2563eb;
  --accent-soft: #eff4ff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1f2b;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --ok-soft: #e8f6ec;
  --off: #cbd1da;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --shadow-hover: 0 4px 12px rgba(16,24,40,.08), 0 16px 40px rgba(16,24,40,.12);
}

* { box-sizing: border-box; }

/* Garante que o atributo hidden sempre esconda, mesmo com display em classe */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 42px; width: auto; border-radius: 8px; }
.brand-text h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: .82rem;
  color: var(--text-muted);
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0 22px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr 1.3fr 1.2fr;
  gap: 10px;
  margin-bottom: 16px;
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 11px 14px 11px 40px;
}
input[type="search"], select {
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select { cursor: pointer; }
input[type="search"]:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.result-count {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 4px 2px 16px;
}

/* ---------- Grid de cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: #d5dbe5;
}
.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Mídia (foto ou placeholder) */
.card-media {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f1f3f6;
  overflow: hidden;
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}
.card:hover .card-img { transform: scale(1.04); }
.media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #eef1f5, #e3e8ef);
  color: #9aa3b2;
}
.media-placeholder.linha-pesada  { background: linear-gradient(135deg,#fdecea,#f8d7d2); color:#c0392b; }
.media-placeholder.linha-leve    { background: linear-gradient(135deg,#e8f1ff,#d4e4ff); color:#1d4ed8; }
.media-placeholder.linha-amarela { background: linear-gradient(135deg,#fff5d6,#ffe9a8); color:#a16207; }
.media-placeholder .ph-icon svg { width: 46px; height: 46px; opacity: .85; }
.media-placeholder .ph-fab {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .9;
}
.card-fab {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-modelo {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: -6px 0 0;
  line-height: 1.2;
}
.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f3f6;
  color: var(--text-muted);
}
.badge.linha-pesada { background: #fdecea; color: #c0392b; }
.badge.linha-leve   { background: #e8f1ff; color: #1d4ed8; }
.badge.linha-amarela{ background: #fff5d6; color: #a16207; }

.card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.progress-track {
  flex: 1;
  height: 7px;
  background: #eef0f3;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s;
}
.progress-text {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: .72rem;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  white-space: nowrap;
}
.chip.more { background: #f1f3f6; color: var(--text-muted); }
.chip.none { background: #f1f3f6; color: var(--text-muted); }

/* ---------- Empty ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 22px 0;
  margin-top: auto;
}
.site-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer p { margin: 0; font-size: .82rem; color: var(--text-muted); }
.footer-contato {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.footer-contato:hover { text-decoration: underline; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16,24,40,.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
  position: relative;
  box-shadow: 0 24px 60px rgba(16,24,40,.3);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-media {
  width: calc(100% + 52px);
  margin: -26px -26px 18px;
  aspect-ratio: 16 / 9;
  background: #f1f3f6;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
}
.modal-media .card-media { aspect-ratio: 16 / 9; height: 100%; }
.modal-media .media-placeholder .ph-icon svg { width: 64px; height: 64px; }
.modal-media .media-placeholder .ph-fab { font-size: .85rem; }
.foto-credito {
  display: block;
  font-size: .68rem;
  color: var(--text-muted);
  text-decoration: none;
  margin: 6px 2px -6px;
}
a.foto-credito:hover { text-decoration: underline; color: var(--accent); }
.modal-fab {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.modal-head h2 {
  margin: 4px 0 10px;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 6px;
}
.modal-subhead {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin: 22px 0 12px;
}
.signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.signal-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .9rem;
  padding: 4px 0;
}
.signal-list li.off { color: var(--text-muted); }
.sig-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .7rem;
  font-weight: 700;
}
.sig-icon.yes { background: var(--ok-soft); color: var(--ok); }
.sig-icon.no  { background: #f1f3f6; color: var(--off); }

/* ---------- Responsivo ---------- */
@media (max-width: 780px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-value { font-size: 1.5rem; }
}
@media (max-width: 480px) {
  .toolbar { grid-template-columns: 1fr; }
  .signal-list { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
}
