/* Garante que [hidden] sempre oculta o elemento independente de regras CSS */
[hidden] { display: none !important; }

/* ── Tema claro (padrão) ──────────────────────────────────────────────────── */
:root {
  --bg-color:      #f1f5f9;
  --bg-secondary:  #ffffff;
  --text-color:    #0f172a;
  --text-muted:    #64748b;
  --primary:       #2563eb;
  --primary-hover: #1d4ed8;
  --secondary:     #7c3aed;
  --accent:        #059669;
  --danger:        #dc2626;

  --glass-bg:        rgba(255, 255, 255, 0.72);
  --glass-border:    rgba(15, 23, 42, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.95);
  --card-shadow:     0 2px 12px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --blur:            blur(16px);

  --bg-gradient:
    radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.04) 0%, transparent 40%);

  --font-sans:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
}

/* ── Tema escuro ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-color:      #0f111a;
  --bg-secondary:  #1e293b;
  --text-color:    #e2e8f0;
  --text-muted:    #94a3b8;
  --primary:       #3b82f6;
  --primary-hover: #2563eb;
  --secondary:     #8b5cf6;
  --accent:        #10b981;
  --danger:        #f43f5e;

  --glass-bg:        rgba(30, 41, 59, 0.45);
  --glass-border:    rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --card-shadow:     0 8px 32px rgba(0, 0, 0, 0.4);

  --bg-gradient:
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 30%),
    radial-gradient(circle at 85% 30%, rgba(14, 165, 233, 0.10) 0%, transparent 30%);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--primary-hover); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ── Glassmorphism ───────────────────────────────────────────────────────── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  border-radius: 16px;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%   { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4); }
  70%  { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar              { width: 8px; height: 8px; }
::-webkit-scrollbar-track        { background: var(--bg-color); }
::-webkit-scrollbar-thumb        { background: var(--glass-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover  { background: var(--text-muted); }
/* ─────────────────────────────────────────────────────────────────────────────
   App.css — Portal CATMAT
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Home Page Layout ────────────────────────────────────────────────────── */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.3s;
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header-logo {
  display: flex;
  align-items: center;
}

.header-portal-img {
  height: 84px;
  width: auto;
}

[data-theme="dark"] .header-portal-img {
  filter: brightness(1.5) saturate(0.9) drop-shadow(0 1px 6px rgba(0, 0, 0, 0.4));
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Theme Toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--glass-border);
  color: var(--text-color);
  transform: rotate(12deg);
}

/* ── Favorites Header Button & Panel ────────────────────────────────────── */
.fav-wrapper {
  position: relative;
}

.fav-header-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}

.fav-header-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.fav-header-btn.has-favs {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.06);
}

.fav-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.fav-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 340px;
  background: var(--bg-secondary);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--card-shadow), 0 20px 50px rgba(0, 0, 0, 0.15);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

[data-theme="dark"] .fav-panel {
  background: rgba(15, 17, 30, 0.97);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.fav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-color);
}

.fav-panel-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #ef4444;
}

.fav-panel-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.fav-panel-close:hover {
  color: var(--text-color);
  background: var(--glass-border);
}

.fav-panel-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.fav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 380px;
  overflow-y: auto;
}

.fav-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--glass-border);
}

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

.fav-item-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 1rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  min-width: 0;
}

.fav-item-link:hover {
  background: rgba(79, 70, 229, 0.05);
}

.fav-item-code {
  font-size: 0.74rem;
  color: var(--primary);
  font-weight: 600;
  font-family: monospace;
}

.fav-item-desc {
  font-size: 0.82rem;
  color: var(--text-color);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-remove {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.7rem 0.75rem;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.fav-item-remove:hover {
  color: #ef4444;
}

/* ── Heart / Amei Button (cards + details) ───────────────────────────────── */
.heart-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.32rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.heart-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.heart-btn.heart-active {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
  color: #ef4444;
}

/* ── Hero Section ────────────────────────────────────────────────────────── */
.hero-wrapper {
  width: 100%;
}

.hero-section {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 0.5rem 2rem 0;
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 1.25rem;
  align-items: center;
}

.hero-headline {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--text-color) 40%, var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.55;
}

/* ── Hero Illustration ───────────────────────────────────────────────────── */
.hero-img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero-img {
  width: 100%;
  max-width: 460px;
  height: auto;
  border-radius: 20px;
  animation: heroFloat 5s ease-in-out infinite;
  filter: drop-shadow(0 16px 36px rgba(37, 99, 235, 0.18));
}

[data-theme="dark"] .hero-img {
  filter: drop-shadow(0 24px 48px rgba(59, 130, 246, 0.30)) brightness(0.92) saturate(1.1);
}

/* SVG hero animation */
.hero-anim-svg {
  width: 100%;
  max-width: 460px;
  height: auto;
  overflow: visible;
}
.hanim-main { animation: heroFloat 5s   ease-in-out infinite; }
.hanim-c1   { animation: heroFloat 5.5s ease-in-out infinite 0.8s; }
.hanim-c2   { animation: heroFloat 4.8s ease-in-out infinite 1.5s; }
.hanim-c3   { animation: heroFloat 5.2s ease-in-out infinite 0.4s; }

@keyframes heroFloat {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-14px);
  }
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 0.5rem 2rem 0;
}

/* ── Search Module ───────────────────────────────────────────────────────── */
.search-module {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 20;
}

/* ── Hero Search (landing + home shared) ─────────────────────────────────── */
.hero-search-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.hero-search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.hero-search-wrap > svg {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.hero-search-input {
  width: 100%;
  background: var(--bg-secondary);
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  padding: 0.85rem 2.5rem 0.85rem 3rem;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search-input::placeholder { color: var(--text-muted); }

.hero-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] .hero-search-input {
  background: rgba(15, 17, 26, 0.7);
}

[data-theme="dark"] .hero-search-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.hero-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.hero-search-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

.hero-search-chips {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.hero-chips-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}

.hero-chip:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.3);
  color: var(--primary);
}

[data-theme="dark"] .hero-chip:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.hero-api-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.hero-api-link:hover { color: var(--primary); }

/* ── Empty State Panel ───────────────────────────────────────────────────── */
.empty-state-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 3.5rem 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.empty-state-icon {
  color: var(--glass-border);
  margin-bottom: 0.5rem;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
}

.empty-state-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── Search Controls (legacy filter) ─────────────────────────────────────── */
.search-controls {
  display: flex;
  gap: 0.875rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  background: var(--bg-secondary);
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 2.25rem 0.8rem 3rem;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: all 0.25s;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

[data-theme="dark"] .search-input {
  background: rgba(15, 17, 26, 0.7);
}

[data-theme="dark"] .search-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.search-clear-btn {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
  cursor: pointer;
}

.search-clear-btn:hover {
  color: var(--text-color);
  background: var(--glass-border);
}

/* ── Ver Mais ────────────────────────────────────────────────────────────── */
.ver-mais-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--glass-bg);
  border: 1px dashed var(--glass-border);
  border-radius: 14px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.25rem;
}

.ver-mais-btn:hover {
  background: rgba(79, 70, 229, 0.07);
  border-color: var(--primary);
  transform: translateY(-1px);
}

[data-theme="dark"] .ver-mais-btn:hover {
  background: rgba(99, 102, 241, 0.12);
}

.ver-mais-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

/* ── Filter ──────────────────────────────────────────────────────────────── */
.filter-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-select {
  background: var(--bg-secondary);
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  padding: 0.8rem 1rem 0.8rem 2.25rem;
  border-radius: 12px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
  min-width: 180px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

[data-theme="dark"] .filter-select {
  background: rgba(15, 17, 26, 0.7);
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ── Active Filter Chips ─────────────────────────────────────────────────── */
.active-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.3);
  color: var(--primary);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.filter-chip-remove {
  background: transparent;
  border: none;
  color: var(--primary);
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.filter-chip-remove:hover {
  opacity: 1;
}

/* ── Search status icon ──────────────────────────────────────────────────── */
.search-action-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1.1rem;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, opacity 0.18s, transform 0.12s;
  white-space: nowrap;
}

.search-action-btn:hover:not(:disabled) {
  background: var(--primary-hover, color-mix(in srgb, var(--primary) 85%, #000));
  transform: translateY(-1px);
}

.search-action-btn:active:not(:disabled) {
  transform: translateY(0);
}

.search-action-btn:disabled,
.search-action-btn.search-action-loading {
  opacity: 0.65;
  cursor: default;
}

/* ── Suggestion Chips (populares) ────────────────────────────────────────── */
.suggestion-chips {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.chips-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  padding: 0.28rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
}

.chip:hover {
  background: rgba(79, 70, 229, 0.08);
  border-color: rgba(79, 70, 229, 0.3);
  color: var(--primary);
  transform: translateY(-1px);
}

[data-theme="dark"] .chip:hover {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

/* ── Loader ──────────────────────────────────────────────────────────────── */
.spinner,
.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ── Lantern loader ──────────────────────────────────────────────────────── */
.lantern-loader {
  display: inline-block;
  filter: drop-shadow(0 0 12px color-mix(in srgb, #f59e0b 35%, transparent));
  animation: lantern-sway 2.4s ease-in-out infinite;
}

.lantern-loader .lantern-flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: lantern-flicker 0.9s ease-in-out infinite;
}

.lantern-loader .lantern-flame-inner {
  animation: lantern-flicker-inner 0.55s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.lantern-loader .lantern-glass {
  animation: lantern-glow 1.6s ease-in-out infinite;
}

@keyframes lantern-sway {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg);  }
}

@keyframes lantern-flicker {
  0%, 100% { transform: scale(1, 1)        translateY(0); }
  25%      { transform: scale(0.92, 1.08)  translateY(-0.5px); }
  50%      { transform: scale(1.05, 0.95)  translateY(0.5px); }
  75%      { transform: scale(0.96, 1.04)  translateY(-0.3px); }
}

@keyframes lantern-flicker-inner {
  0%, 100% { transform: scale(1, 1);     opacity: 0.85; }
  50%      { transform: scale(0.85, 1.1); opacity: 1; }
}

@keyframes lantern-glow {
  0%, 100% { fill: #fff5db; }
  50%      { fill: #ffe18a; }
}

[data-theme="dark"] .lantern-loader .lantern-glass {
  animation-name: lantern-glow-dark;
}

@keyframes lantern-glow-dark {
  0%, 100% { fill: #3b2a14; }
  50%      { fill: #7a5418; }
}

@media (prefers-reduced-motion: reduce) {
  .lantern-loader,
  .lantern-loader .lantern-flame,
  .lantern-loader .lantern-flame-inner,
  .lantern-loader .lantern-glass {
    animation: none;
  }
}

/* ── Results Header ──────────────────────────────────────────────────────── */
.results-header {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.results-summary-row {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
}

.results-summary-row span { color: var(--text-muted); font-weight: 400; font-size: 0.9rem; }

/* ── Filter tabs ─────────────────────────────────────────────────────────── */
.results-filter-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 0.1rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.filter-tab:hover { color: var(--text-color); border-color: var(--text-muted); }

.filter-tab.active-exact  { background: rgba(5,150,105,.1); border-color: rgba(5,150,105,.4); color: #059669; }
.filter-tab.active-high   { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.4); color: #d97706; }
.filter-tab.active-similar{ background: rgba(100,116,139,.12); border-color: rgba(100,116,139,.35); color: var(--text-muted); }
.filter-tab.active-all    { background: rgba(79,70,229,.1); border-color: rgba(79,70,229,.35); color: var(--primary); }
.filter-tab .tab-count    { font-size: 0.72rem; opacity: .7; }

.sort-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-select {
  background: var(--bg-secondary);
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s;
}
.sort-select:focus { border-color: var(--primary); }

/* ── Category filter row ─────────────────────────────────────────────────── */
.results-category-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* ── Search hint bar ─────────────────────────────────────────────────────── */
.search-hint-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.25rem;
  min-height: 1.5rem;
}

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

.search-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(5,150,105,.08);
  border: 1px solid rgba(5,150,105,.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ── Result Card v2 ──────────────────────────────────────────────────────── */
.rc {
  display: grid;
  grid-template-columns: 1fr 175px;
  gap: 1rem;
  padding: 0.7rem 1rem;
  margin-bottom: 0.35rem;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  border-left: 3px solid transparent;
}

.rc { cursor: pointer; }
.rc:hover { transform: translateY(-1px); }

.rc-exact  { border-left-color: #059669; }
.rc-high   { border-left-color: #f59e0b; }
.rc-similar{ border-left-color: var(--glass-border); }

/* Left column */
.rc-left { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }

.rc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  width: fit-content;
}

.rc-badge-exact   { background: rgba(5,150,105,.1); color: #059669; border: 1px solid rgba(5,150,105,.3); }
.rc-badge-high    { background: rgba(245,158,11,.1); color: #d97706; border: 1px solid rgba(245,158,11,.3); }
.rc-badge-similar { background: rgba(100,116,139,.1); color: var(--text-muted); border: 1px solid var(--glass-border); }

.rc-code {
  font-size: 0.9rem;
  font-weight: 800;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.rc-code-exact   { color: #059669; }
.rc-code-high    { color: #d97706; }
.rc-code-similar { color: var(--text-muted); }

.rc-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-color);
  line-height: 1.35;
  margin: 0;
}

.rc-attrs {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.2rem;
  padding: 0.45rem 0.65rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 7px;
}

.rc-attrs-collapsed { display: none; }

.rc-attrs-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.7rem;
  font-family: inherit;
  color: var(--text-muted);
  padding: 0.1rem 0;
  transition: color 0.15s;
  width: fit-content;
}

.rc-attrs-toggle:hover { color: var(--primary); }

.rc-attrs-chevron { transition: transform 0.2s; flex-shrink: 0; }

.rc-attr {
  display: grid;
  grid-template-columns: 68px 1fr;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.79rem;
  line-height: 1.45;
  min-width: 0;
}

.rc-attr-icon { flex-shrink: 0; color: var(--text-muted); }

.rc-attr-key {
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.rc-attr-val {
  color: var(--text-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rc-found-by {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.rc-found-by strong { color: var(--text-color); }

/* Right column */
.rc-right {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  flex-shrink: 0;
}

.rc-compat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.rc-compat-pct {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
}

.rc-compat-bar {
  height: 4px;
  background: var(--glass-border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.15rem;
}

.rc-compat-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.rc-btn-use {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}

.rc-btn-use:hover { background: var(--primary-hover); transform: translateY(-1px); }

.rc-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
}

.rc-btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: rgba(79,70,229,.04); }

.rc-btn-detail {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  text-align: center;
  padding: 0.2rem 0;
  transition: opacity 0.15s;
}

.rc-btn-detail:hover { opacity: 0.75; }

.rc .heart-btn {
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  min-width: 0;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .rc { grid-template-columns: 1fr; }
  .rc-right { flex-direction: row; flex-wrap: wrap; }
  .rc-compat-label, .rc-compat-pct, .rc-compat-bar { display: none; }
  .rc-btn-use, .rc-btn-secondary { width: auto; flex: 1; }
}

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

.results-count strong {
  color: var(--text-color);
}

/* ── Results layout (sidebar + column) ───────────────────────────────────── */
.results-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.results-layout.has-sidebar {
  grid-template-columns: 260px 1fr;
}

.results-column { min-width: 0; }

/* ── Groups sidebar ───────────────────────────────────────────────────────── */
.groups-sidebar {
  padding: 0.85rem 0.75rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  scrollbar-width: thin;
}

.groups-sidebar-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  padding: 0 0.35rem 0.5rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 0.4rem;
}

.gsb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.4rem;
  padding: 0.38rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 7px;
  font-family: inherit;
  color: var(--text-color);
  text-align: left;
  transition: background 0.14s, color 0.14s;
}

.gsb-item:hover { background: var(--bg-secondary); }

.gsb-item-active {
  background: rgba(79,70,229,.1);
  color: var(--primary);
}

.gsb-item-name {
  flex: 1;
  min-width: 0;
  font-size: 0.77rem;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.gsb-item-active .gsb-item-name { font-weight: 700; }

.gsb-item-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  flex-shrink: 0;
  min-width: 1.4rem;
  text-align: center;
}

.gsb-item-active .gsb-item-count {
  background: rgba(79,70,229,.15);
  color: var(--primary);
}

@media (max-width: 768px) {
  .results-layout.has-sidebar {
    grid-template-columns: 1fr;
  }
  .groups-sidebar {
    position: static;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .groups-sidebar-title { display: none; }
  #groups-sidebar-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .gsb-item { width: auto; white-space: nowrap; }
}

.results-filter-note {
  color: var(--primary);
  font-style: italic;
}

/* ── Export Button & Dropdown ────────────────────────────────────────────── */
.export-wrapper {
  position: relative;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-color);
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.export-btn:hover {
  background: var(--glass-highlight);
  border-color: var(--primary);
}

.export-chevron {
  transition: transform 0.2s;
}

.export-chevron.rotated {
  transform: rotate(180deg);
}

.export-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-secondary);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--card-shadow), 0 16px 40px rgba(0, 0, 0, 0.12);
  z-index: 50;
  min-width: 200px;
  overflow: hidden;
  animation: fadeIn 0.15s ease-out;
}

[data-theme="dark"] .export-dropdown {
  background: rgba(15, 17, 30, 0.97);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.export-option {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--glass-border);
}

.export-option:last-child {
  border-bottom: none;
}

.export-option:hover {
  background: rgba(79, 70, 229, 0.07);
}

[data-theme="dark"] .export-option:hover {
  background: rgba(99, 102, 241, 0.12);
}

.export-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Results List ────────────────────────────────────────────────────────── */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 3rem;
}

.result-card {
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .result-card:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.result-card:hover::before {
  opacity: 1;
}

.best-result-card {
  border: 1px solid rgba(5, 150, 105, 0.4) !important;
  background: rgba(5, 150, 105, 0.03) !important;
}

[data-theme="dark"] .best-result-card {
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: rgba(16, 185, 129, 0.04) !important;
}

.best-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.other-result-card {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.other-result-card.faded {
  opacity: 0.25;
  transform: scale(0.98);
}

/* ── Card Header ─────────────────────────────────────────────────────────── */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.catmat-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.item-code {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid rgba(79, 70, 229, 0.25);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  letter-spacing: 0.03em;
}

[data-theme="dark"] .item-code {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.3);
}

.item-code-best {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: transparent !important;
}

.copy-button {
  background: var(--glass-border);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
}

.copy-button:hover {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  transform: scale(1.06);
}

.grupo-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(124, 58, 237, 0.2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

[data-theme="dark"] .grupo-badge {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.25);
}

/* ── Item Description ────────────────────────────────────────────────────── */
.item-description {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text-color);
  line-height: 1.5;
}

.item-description em.hl {
  font-style: normal;
  color: #92400e;
  background: rgba(217, 119, 6, 0.12);
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}

[data-theme="dark"] .item-description em.hl {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.15);
}

/* ── Score Bar ───────────────────────────────────────────────────────────── */
.score-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.score-bar-track {
  flex: 1;
  height: 4px;
  background: var(--glass-border);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s;
}

.score-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 34px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Card Actions ────────────────────────────────────────────────────────── */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
}

.price-panel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  font-family: inherit;
}

.price-panel-link:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

[data-theme="dark"] .price-panel-link {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .price-panel-link:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.feedback-group {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.feedback-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  min-width: 34px;
  height: 34px;
  padding: 0 0.4rem;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
  cursor: pointer;
}

.feedback-btn:hover {
  background: var(--glass-border);
  color: var(--text-color);
  transform: scale(1.06);
}

.likes-count {
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 0.1rem;
}

.feedback-like-active {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: var(--accent);
}

.feedback-like-active:hover {
  background: rgba(5, 150, 105, 0.18);
  color: var(--accent);
}

.feedback-dislike-active {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
  color: var(--danger);
}

.feedback-dislike-active:hover {
  background: rgba(220, 38, 38, 0.18);
  color: var(--danger);
}

[data-theme="dark"] .feedback-like-active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .feedback-dislike-active {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-clear-filter {
  margin-top: 1.25rem;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.25);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.empty-clear-filter:hover {
  background: rgba(79, 70, 229, 0.15);
}

/* ── Error Panel ─────────────────────────────────────────────────────────── */
.error-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem;
  text-align: center;
  color: var(--danger);
  margin-bottom: 1.5rem;
}

/* ── Stats Section ───────────────────────────────────────────────────────── */
.stats-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.stat-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
}

.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--glass-border);
  margin-bottom: 0.1rem;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.35;
}

/* ── Site Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 1.1rem 2rem;
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.site-footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.site-footer-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 500;
}

.footer-sep {
  opacity: 0.35;
}

.footer-gov {
  font-weight: 600;
  color: var(--text-color);
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* ── Legacy: mantido para Details page ──────────────────────────────────── */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header legado (Details page) */
.app-container header {
  text-align: center;
  margin-bottom: 3rem;
  padding-top: 2rem;
}

.header-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.3);
}

.header-logo-icon {
  color: white;
}

.title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-color) 40%, var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.05em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.app-footer {
  text-align: center;
  padding: 2rem;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--glass-border);
}

.app-footer a {
  color: var(--primary);
}

/* ── Details Page v2 ─────────────────────────────────────────────────────── */
.dt-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dt-breadcrumb button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  transition: opacity 0.15s;
}

.dt-breadcrumb button:hover {
  opacity: 0.7;
  text-decoration: underline;
}

.dt-breadcrumb span {
  color: var(--text-muted);
}

.dt-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--glass-border);
  border-top: 3px solid var(--primary);
}

.dt-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.dt-top-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dt-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dt-catmat-badge {
  background: var(--primary);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dt-grupo-chip {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.25);
  padding: 0.22rem 0.7rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 500;
}

.dt-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg);
  color: var(--text-color);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s;
}

.dt-action-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.dt-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}

.dt-icon-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dt-likes-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 6px;
  white-space: nowrap;
}

.dt-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dt-category-label {
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
}

.dt-item-name {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-color);
  line-height: 1.3;
  margin: 0;
}

.dt-code-line {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.dt-code-value {
  color: var(--primary);
  font-weight: 600;
}

.dt-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
}

.dt-info-box {
  background: var(--glass-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.dt-info-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.dt-info-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  line-height: 1.35;
}

.dt-info-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.dt-info-accent {
  color: var(--accent) !important;
  font-weight: 700;
  font-size: 1rem;
}

/* ── KPI Section ─────────────────────────────────────────────────────────── */
.dt-kpi-section {
  margin-bottom: 1rem;
}

.dt-kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.dt-kpi-header-title {
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

.dt-kpi-more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  transition: opacity 0.15s;
}

.dt-kpi-more-link:hover {
  opacity: 0.75;
  text-decoration: underline;
}

.dt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.dt-kpi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.25rem 0.75rem;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  text-align: center;
  transition: transform 0.18s, box-shadow 0.18s;
}

.dt-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.dt-kpi-label {
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.dt-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
}

.dt-kpi-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.dt-purchases-section {
  margin-top: 1.25rem;
}

.dt-purchases-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dt-purchase-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.dt-purchase-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 0 0 120px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
  text-align: right;
}

.dt-purchase-price span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0;
  line-height: 1.2;
}

.dt-purchase-info {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.dt-purchase-org {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-purchase-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dt-purchase-label {
  font-weight: 600;
  color: var(--text-color);
}

.dt-purchase-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dt-purchase-qty {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dt-purchase-date {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
}

/* ── Price scatter chart ──────────────────────────────────────────────────── */
.dt-chart-wrap {
  margin-top: 1.25rem;
  padding: 1.1rem 1.25rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
}

.dt-chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.dt-chart-titles {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dt-chart-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-color);
}

.dt-chart-subtitle {
  font-size: 0.71rem;
  color: var(--text-muted);
}

.dt-chart-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.dt-chart-legend-outlier {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.dt-chart-dot-outlier {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.dt-chart-how-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.71rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.dt-chart-how-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.dt-chart-how-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.dt-chart-canvas-wrap {
  position: relative;
  height: 300px;
}

/* ────────────────────────────────────────────────────────────────────────── */
.dt-purchase-row--link {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.dt-purchase-row--link:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.dt-purchase-open-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.dt-purchase-open-link:hover {
  border-color: var(--primary);
  background: rgba(99,102,241,0.06);
}

.dt-licitaai-link {
  font-size: 0.72rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.dt-licitaai-link:hover { text-decoration: underline; }

.dt-licitaai-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  align-self: flex-start;
}
.dt-licitaai-approved { background: rgba(5,150,105,.1); color: #059669; border: 1px solid rgba(5,150,105,.3); }
.dt-licitaai-rejected { background: rgba(239,68,68,.08); color: #dc2626; border: 1px solid rgba(239,68,68,.25); }

@media (max-width: 640px) {
  .dt-purchase-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .dt-purchase-price {
    align-items: flex-start;
    flex: none;
  }
}

@media (max-width: 640px) {
  .dt-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dt-item-name {
    font-size: 1.25rem;
  }

  .dt-card {
    padding: 1.25rem;
  }

  .dt-top-right {
    flex-wrap: wrap;
  }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
    padding: 1.25rem 1.5rem 0.75rem;
  }

  .hero-img-wrapper {
    display: none;
  }

  .stats-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-content {
    padding: 1.5rem 1.5rem 0;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 1rem;
  }

  .title {
    font-size: 2.2rem;
  }

  .hero-headline {
    font-size: 1.85rem;
  }

  .search-controls {
    flex-direction: column;
  }

  .filter-wrapper {
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .search-input-wrapper {
    min-width: unset;
    width: 100%;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .feedback-group {
    margin-left: 0;
  }

  .stats-section {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-header-inner {
    padding: 0.7rem 1rem;
  }

  .main-content {
    padding: 1rem 1rem 0;
  }

  .site-footer {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .suggestions-dropdown {
    font-size: 0.85rem;
  }

  .grupo-badge {
    max-width: 130px;
  }
}

/* ── Nav header (compartilhado entre landing e demais páginas) ────────────── */
.landing-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin: 0 auto;
}

.landing-nav-link {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.landing-nav-link:hover { color: var(--text-color); background: color-mix(in srgb, var(--text-muted) 14%, transparent); }
.landing-nav-link.active { color: var(--primary); font-weight: 600; }
.nav-sep { color: var(--glass-border); font-size: 0.9rem; padding: 0 0.1rem; user-select: none; }

@media (max-width: 900px) {
  .landing-nav { display: none; }
}