/* ========================================
   DEFINIÇÕES CSS - SISTEMA ADZEP
   Estilos padronizados para todo o sistema
   ======================================== */

/* Base tipográfica global */
:root {
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    /* Largura padrão unificada do container principal */
    --container-max: 1100px;
    --container-pad: 16px;
    --space-12: 12px; /* base de espaçamento compacto */
    --space-16: 16px;
    --space-20: 20px;
    --space-24: 24px; /* base confortável */
    /* Tokens de tema globais (usados por Tailwind e componentes) */
    --accent-orange: #e8a559;
    --brand-accent: var(--accent-orange);
    --primary-dark: #1A3A2E;
    --primary-green: #2D5F4D;
    --color-primary: #e8a559;
    --color-secondary: #374151;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
}
/* Offset global para páginas com header fixo (aplicado só quando necessário) */
:root {
    --header-height: 56px; /* padrão claro */
    --header-back-height: 0px; /* link voltar abaixo do header; 0 quando ausente */
}
body.has-fixed-header {
    padding-top: calc(var(--header-height, 56px) + var(--header-back-height, 0px));
}
body {
    font-family: var(--font-sans);
    color: #1f2937;
    /* Apenas cor de fundo: não zera background-image (preserva gradientes de páginas públicas) */
    background-color: var(--bg-light, #ffffff);
    margin: 0;
    padding: 0;
}

/* ========================================
   CONTAINERS E LAYOUT
   ======================================== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}
.stack-12 > * + * { margin-top: var(--space-12); }
.stack-16 > * + * { margin-top: var(--space-16); }
.stack-24 > * + * { margin-top: var(--space-24); }
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
}
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-16);
}
@media (max-width: 840px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Header/Footer containers (largura consistente) */
.header-content, .footer-content {
    max-width: var(--container-max);
    margin: 0 auto;
    padding-left: var(--container-pad);
    padding-right: var(--container-pad);
}

/* Tipografia utilitária */
.title-xl { font-size: 28px; font-weight: 700; line-height: 1.2; }
.title-lg { font-size: 22px; font-weight: 700; line-height: 1.2; }
.text-muted { color: #6b7280; }

/* Cartões e superfícies */
.card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: var(--space-16);
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
}

/* ========================================
   INPUTS E SELECTS
   ======================================== */
input, select, textarea {
    padding: 12px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: #ffffff;
    color: #1f2937;
    width: auto;
    min-width: 220px;
    box-sizing: border-box;
}

/* Correção global: checkboxes e radios não devem herdar largura/padding dos inputs de texto */
input[type="checkbox"], input[type="radio"] {
    padding: 0;
    min-width: 0;
    width: auto;
    height: auto;
    appearance: auto;
    border: none;
    box-shadow: none;
    background: transparent;
    vertical-align: middle;
}

input:focus, select:focus, textarea:focus {
    outline: none;
  border-color: #e8a559;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input:hover, select:hover, textarea:hover {
    border-color: #9ca3af;
}

input:disabled, select:disabled, textarea:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Estilos específicos para diferentes tipos de input */
input[type="text"], input[type="email"], input[type="password"], input[type="url"] {
    height: 48px;
}

input[type="number"] {
    height: 48px;
}

/* Grupo de rádios compacto (evita largura excessiva) */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.radio-group label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    width: auto;
    line-height: 1;
    min-height: 36px;
}
.radio-group label span { line-height: 1; display: inline-block; }
.radio-group label:hover {
    background: #F9FAFB;
}
.radio-group input[type="radio"] {
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    align-self: center;
}

/* Forçar radios em uma única linha onde necessário */
.radio-inline { flex-wrap: nowrap; }
.radio-group label { margin: 0; }

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    height: 48px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Rótulo inline dentro de selects (layout minimalista) */
.select-inline-label {
    position: relative;
    --silw: 150px; /* largura padrão do rótulo inline */
}
.select-inline-label::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700; /* negrito solicitado */
    color: #374151;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(var(--silw) - 24px);
    background: #fff;
    padding: 0 6px;
    border-radius: 4px;
    transition: color .2s ease;
}
.select-inline-label:focus-within::before { color: #2563eb; }
.select-inline-label select,
.select-inline-label .inline-control {
    padding-left: var(--silw);
    text-indent: var(--silw);
}

/* utilitários de largura do rótulo inline */
.silw-120 { --silw: 120px; }
.silw-150 { --silw: 150px; }
.silw-180 { --silw: 180px; }
.silw-210 { --silw: 210px; }

@media (max-width: 480px) {
    .select-inline-label select, .select-inline-label .inline-control { padding-left: 120px; text-indent: 120px; }
}

/* ========================================
   BOTÕES
   ======================================== */
.btn {
    padding: 10px 20px;
    /* Mantém altura consistente entre variantes (inclui a espessura da borda) */
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    /* Evita animar medidas como padding/altura durante a carga de CSS */
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    white-space: nowrap;
    text-align: center;
    line-height: 1.5;
    font-family: inherit;
    box-sizing: border-box;
}

/* Variações de botões (padronizadas com paleta brand) */
.btn-primary {
    background-color: var(--brand-accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--brand-accent-hover, #d89349);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 165, 89, 0.3);
}

.btn-secondary {
    background-color: var(--brand-neutral-700);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #1f2937; /* brand-neutral-800 aproximado */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.3);
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #e8a559;
    color: #e8a559;
}

.btn-outline:hover {
    background-color: #e8a559;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Tamanhos de botões */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Tamanho extra pequeno para granularidade fina */
.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
}

/* Botão rápido de IA: compacto e estável em redimensionamento */
.btn-ai-quick {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0; /* evita “flick” por encolhimento no flex container */
}
.btn-ai-quick span,
.btn-ai-quick .icon { flex: 0 0 auto; }
.btn-ai-quick .icon {
    width: 12px;
    height: 12px;
    display: block;
    margin: 0; /* não usar margin-right; gap já cuida do espaçamento */
}

/* Botão IA padrão: estabiliza medidas para evitar salto visual na carga */
.btn-ai {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-xl {
    padding: 18px 36px;
    font-size: 18px;
}

/* Estados especiais */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:active {
    transform: translateY(0);
}

/* ========================================
   GRUPOS DE FORMULÁRIO
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group .help-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: #ef4444;
}

.form-group.error .error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

/* ========================================
   GRID DE FORMULÁRIO
   ======================================== */
.form-grid {
    display: grid;
    gap: 20px;
}

.form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* ========================================
   HEADER - Topo do sistema
   ======================================== */
.header {
    background: #ffffff;
    color: #1f2937;
    padding: 20px 40px;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: none;
}
.header-content {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}
.container {
    max-width: var(--container-max);
    margin: 24px auto;
    padding: 0 16px;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.h1 {
    font-weight: 600;
    font-size: 22px;
    margin: 8px 0 16px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    /* Evita quebra de linha entre "AdZep" e "Trends" */
    white-space: nowrap;
    /* Impede que o logo seja comprimido em layouts estreitos */
    flex-shrink: 0;
}
.logo > span { white-space: nowrap; }
.logo .logo-trends {
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0;
}
.logo:hover { color: inherit; }
.logo:visited { color: inherit; }
.logo-icon {
    width: 40px;
    height: 40px;
  background: var(--accent-orange, #e8a559);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
/* Garantir consistência do SVG do logo entre módulos */
.header .logo-icon svg { width: 24px; height: 24px; display: block; }
.icon {
    width: 14px;
    height: 14px;
    display: inline-block;
    vertical-align: -2px;
    stroke: currentColor;
    fill: none;
    margin-right: 6px;
}
.icon svg { width: 100%; height: 100%; }
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}
.user-info > * { flex: 0 0 auto; }
.user-dropdown {
    position: relative;
    margin-left: auto;
    order: 1001;
}
.user-info #btnCreateAI { order: 900; }
.user-info > :not(.user-dropdown) { order: 1; }
.user-dropdown summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    color: #fff;
    /* Melhorias de interação em mobile */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.user-dropdown summary::-webkit-details-marker { display: none; }
.user-dropdown[open] .menu { display: block; }
.user-dropdown .menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: #1f2937;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    min-width: 180px;
    display: none;
    z-index: 50;
}
.user-dropdown .menu a {
    display: block;
    padding: 10px 12px;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}
.user-dropdown .menu a:hover { background: #374151; }
.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
}
.user-badge:visited { color: #fff; }
.user-badge:hover { color: #fff; text-decoration: none; opacity: 0.9; }
.header .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    white-space: nowrap;
}
.btn-secondary { background: #374151; color: #fff; }
.btn-secondary:hover { background: #1f2937; }
@media (max-width: 768px) {
    /* Reverte para empilhamento em coluna no header, como antes */
    .header-content { flex-direction: column; align-items: flex-start; }
    .menu-toggle { margin-left: auto; }
    .primary-nav { flex-basis: 100%; }
}

@media (max-width: 768px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   NAVEGAÇÃO RESPONSIVA / MENU HAMBURGER
   ======================================== */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    cursor: pointer;
}
.menu-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.35); }
.menu-icon {
    position: relative; width: 20px; height: 2px; background: currentColor; display: block; transition: transform .25s ease, background-color .25s ease;
}
.menu-icon::before, .menu-icon::after {
    content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: currentColor; transition: transform .25s ease, top .25s ease;
}
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-toggle.is-active .menu-icon { background: transparent; }
.menu-toggle.is-active .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-toggle.is-active .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

.primary-nav { width: 100%; }
/* Layout padrão do header/nav (desktop-first, minimalista) */
.primary-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Lista de navegação minimalista */
.nav-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.nav-item { display: inline-flex; }
.nav-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 14px; font-weight: 600; text-decoration: none; color: #374151; background: #ffffff; border: 1px solid #E5E7EB; border-radius: 10px; transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease; }
.nav-link:hover { background: #F9FAFB; }
.nav-link.is-active { background: #EFF6FF; color: #1E3A8A; border-color: #BFDBFE; }
.nav-link:focus-visible { outline: 3px solid rgba(30,58,138,0.35); outline-offset: 2px; }
.nav-link .icon { width: 14px; height: 14px; margin-right: 0; }
@media (max-width: 768px) {
    .menu-toggle { display: inline-flex; }
    .primary-nav {
        width: 100%;
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transform: translateY(-8px);
        transition: max-height .25s ease, opacity .25s ease, transform .25s ease;
        position: relative; /* garante contexto de empilhamento para dropdowns internos */
    }
    .primary-nav.is-open {
        max-height: 500px;
        opacity: 1;
        transform: translateY(0);
        overflow: visible; /* permite que o menu do perfil apareça acima/fora sem ser cortado */
        z-index: 100; /* assegura que dropdown não fique atrás de elementos vizinhos */
    }
    .primary-nav .user-info {
        flex-wrap: wrap;
        gap: 8px;
    }
    .primary-nav .btn { width: auto; }
}

@media (min-width: 769px) {
    .primary-nav { max-height: none !important; opacity: 1 !important; transform: none !important; }
    /* Garantir que o botão hamburger não apareça em desktop */
    .menu-toggle { display: none !important; }
}

/* ========================================
   UTILITÁRIOS
   ======================================== */
.w-full {
    width: 100%;
}

.w-auto {
    width: auto;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* ========================================
   FALLBACK DE UTILITÁRIOS ESSENCIAIS (quando Tailwind CDN falhar)
   Mantém layout básico estável em páginas que usam classes Tailwind.
   ======================================== */
/* Grid 12 colunas */
.grid { display: grid; }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* Gaps comuns */
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Colunas (span) padrão */
.col-span-1  { grid-column: span 1 / span 1; }
.col-span-2  { grid-column: span 2 / span 2; }
.col-span-3  { grid-column: span 3 / span 3; }
.col-span-4  { grid-column: span 4 / span 4; }
.col-span-5  { grid-column: span 5 / span 5; }
.col-span-6  { grid-column: span 6 / span 6; }
.col-span-7  { grid-column: span 7 / span 7; }
.col-span-8  { grid-column: span 8 / span 8; }
.col-span-9  { grid-column: span 9 / span 9; }
.col-span-10 { grid-column: span 10 / span 10; }
.col-span-11 { grid-column: span 11 / span 11; }
.col-span-12 { grid-column: span 12 / span 12; }

/* Responsivo md: classes com dois-pontos precisam escapadas */
@media (min-width: 768px) {
  .md\:col-span-1  { grid-column: span 1 / span 1; }
  .md\:col-span-2  { grid-column: span 2 / span 2; }
  .md\:col-span-3  { grid-column: span 3 / span 3; }
  .md\:col-span-4  { grid-column: span 4 / span 4; }
  .md\:col-span-5  { grid-column: span 5 / span 5; }
  .md\:col-span-6  { grid-column: span 6 / span 6; }
  .md\:col-span-7  { grid-column: span 7 / span 7; }
  .md\:col-span-8  { grid-column: span 8 / span 8; }
  .md\:col-span-9  { grid-column: span 9 / span 9; }
  .md\:col-span-10 { grid-column: span 10 / span 10; }
  .md\:col-span-11 { grid-column: span 11 / span 11; }
  .md\:col-span-12 { grid-column: span 12 / span 12; }
}
@media (min-width: 1024px) {
  .lg\:col-span-1  { grid-column: span 1 / span 1; }
  .lg\:col-span-2  { grid-column: span 2 / span 2; }
  .lg\:col-span-3  { grid-column: span 3 / span 3; }
  .lg\:col-span-4  { grid-column: span 4 / span 4; }
  .lg\:col-span-5  { grid-column: span 5 / span 5; }
  .lg\:col-span-6  { grid-column: span 6 / span 6; }
  .lg\:col-span-7  { grid-column: span 7 / span 7; }
  .lg\:col-span-8  { grid-column: span 8 / span 8; }
  .lg\:col-span-9  { grid-column: span 9 / span 9; }
  .lg\:col-span-10 { grid-column: span 10 / span 10; }
  .lg\:col-span-11 { grid-column: span 11 / span 11; }
  .lg\:col-span-12 { grid-column: span 12 / span 12; }
}

/* Flex utilitários básicos */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* Espaçamento utilitário */
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* ========================================
   RESPONSIVIDADE
   ======================================== */
@media (max-width: 640px) {
    input, select, textarea {
        font-size: 16px; /* Evita zoom no iOS */
        width: 100%;
        min-width: 0;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    /* Campos simples devem ocupar 100% no mobile */
    .field input, .field textarea { width: 100%; min-width: 0; }

    /* Topbar e grupos de ações: permitir quebra em múltiplas linhas para evitar overflow */
    .topbar > .flex.items-center { flex-wrap: wrap; gap: 6px; }
    .topbar form.flex.items-center { flex-wrap: wrap; }
    .topbar .btn { flex: 0 0 auto; }
    .topbar .icon-btn { flex: 0 0 auto; }
}

/* ========================================
   ALERTAS
   ======================================== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-weight: 500;
    border: 1px solid #E5E7EB;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border-color: #6EE7B7;
}

/* Mensagem de status do radar: fonte ligeiramente menor para compactar */
#radarServerStatus { font-size: 13px; }

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FCA5A5;
}

.alert-warning {
    background: #FEF3C7;
    color: #92400E;
    border-color: #F59E0B;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #93C5FD;
}

.alert.fade-out { opacity: 0; transition: opacity 0.4s ease; }

/* ========================================
   MODAIS
   ======================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

/* ========================================
   LINK DE VOLTAR (abaixo do logo)
   ======================================== */
.header-back {
    padding: 6px 40px 0; /* alinhar com padding horizontal do header */
}
.header-back-inner {
    max-width: var(--container-max);
    margin: 0 auto;
}
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-top: 10px;
}
.back-home:hover { color: #111827; text-decoration: underline; }
.back-home .icon { margin-right: 0; width: 16px; height: 16px; }

.modal.active { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: transparent; }
.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    width: 92%;
    max-width: 960px;
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}
.modal-title { font-weight: 700; font-size: 18px; color: #111827; margin: 0; }
.modal-close {
    position: absolute; top: 8px; right: 12px;
    border: none; background: transparent; font-size: 22px; cursor: pointer; color: #6B7280;
}
.modal-close:hover { color: #374151; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
/* Modal full-screen para conteúdo embutido (Discover) */
.modal-fullscreen .modal-content { margin: 10px; width: calc(95vw - 20px) !important; height: calc(95vh - 20px) !important; max-width: none !important; max-height: none !important; border-radius: 12px; padding: 0; display: flex; flex-direction: column; box-sizing: border-box; box-shadow: 0 16px 40px rgba(0,0,0,0.2); }
.modal-fullscreen .modal-header { position: sticky; top: 0; z-index: 10; }
.modal-fullscreen .modal-body { padding: 0; flex: 1; }
.modal-fullscreen, .modal-fullscreen .modal-content, .modal-fullscreen .modal-body { overflow: hidden; }
.modal-fullscreen iframe { width: 100%; height: 100%; border: 0; }
/* Animações suaves de abertura/fechamento */
.modal.animating-in .modal-content { animation: modalIn .2s ease-out both; }
.modal.animating-out .modal-content { animation: modalOut .2s ease-in both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
/* Modal full-screen para conteúdo embutido (Discover) */
.modal-fullscreen .modal-content { margin: 10px; width: calc(95vw - 20px) !important; height: calc(95vh - 20px) !important; max-width: none !important; max-height: none !important; border-radius: 12px; padding: 0; display: flex; flex-direction: column; box-sizing: border-box; box-shadow: 0 16px 40px rgba(0,0,0,0.2); }
.modal-fullscreen .modal-header { position: sticky; top: 0; z-index: 10; }
.modal-fullscreen .modal-body { padding: 0; flex: 1; }
.modal-fullscreen iframe { width: 100%; height: 100%; border: 0; }
/* Animações suaves de abertura/fechamento */
.modal.animating-in .modal-content { animation: modalIn .2s ease-out both; }
.modal.animating-out .modal-content { animation: modalOut .2s ease-in both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
/* Modal full-screen para conteúdo embutido (Discover) */
.modal-fullscreen .modal-content { margin: 10px; width: calc(95vw - 20px) !important; height: calc(95vh - 20px) !important; max-width: none !important; max-height: none !important; border-radius: 12px; padding: 0; display: flex; flex-direction: column; box-sizing: border-box; box-shadow: 0 16px 40px rgba(0,0,0,0.2); }
.modal-fullscreen .modal-header { position: sticky; top: 0; z-index: 10; }
.modal-fullscreen .modal-body { padding: 0; flex: 1; }
.modal-fullscreen iframe { width: 100%; height: 100%; border: 0; }
/* Animações suaves de abertura/fechamento */
.modal.animating-in .modal-content { animation: modalIn .2s ease-out both; }
.modal.animating-out .modal-content { animation: modalOut .2s ease-in both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* Divisor visual para separar conteúdo dos botões nos modais */
.modal-divider {
    border-top: 1px solid #E5E7EB;
    margin: 12px 0;
}

/* Header de modal: tipografia auxiliar */
.modal-title-wrapper { flex-grow: 1; padding-right: 12px; }
.modal-header h3 { font-size: 20px; color: #111827; margin: 0; font-weight: 700; }
.modal-header p { font-size: 13px; color: #6B7280; margin-top: 4px; }

/* Campos simples (para modais rápidos) */
.field { margin: 8px 0; }

/* Grid simples para modais e painéis */
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* Layout utilitários para estrutura consistente */
.layout-column { display: flex; flex-direction: column; }
.layout-row { display: flex; flex-direction: row; }
.gap-12 { gap: 12px; }
.gap-8 { gap: 8px; }
.gap-6 { gap: 6px; }
.gap-4 { gap: 4px; }

/* Paleta e tema do modal de concorrentes (harmonia e acessibilidade) */
:root {
    --brand-primary: #2D5F4D; /* verde sóbrio */
    --brand-accent: #e8a559;  /* acento principal (mantém valor atual) */
    --brand-accent-hover: #d89349; /* acento escurecido para hover */
    --brand-neutral-900: #111827;
    --brand-neutral-700: #374151;
    --brand-neutral-500: #6B7280;
    --brand-neutral-300: #E5E7EB;
    --brand-neutral-100: #F3F4F6;
    /* Compatibilidade com tokens antigos */
    --color-primary: var(--brand-accent);
    --color-secondary: var(--brand-neutral-700);
}
.modal-theme-competitor .modal-header { border-bottom-color: var(--brand-neutral-300); }
.modal-theme-competitor .modal-title { color: var(--brand-neutral-900); }
.modal-theme-competitor .modal-content { max-width: 900px; }

/* Stepper de progresso (chips) */
.stepper { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stepper .step { padding: 6px 10px; border: 1px solid var(--brand-neutral-300); border-radius: 999px; font-size: 12px; background: var(--brand-neutral-100); color: var(--brand-neutral-900); font-weight: 600; }
.stepper .step.active { background: var(--brand-neutral-900); color: #fff; border-color: var(--brand-neutral-900); }

/* Lista de exemplos/ajuda */
.help-list { margin: 6px 0 0 16px; list-style: disc; }
.help-list li { margin: 2px 0; }
.help-list li strong { color: var(--brand-neutral-900); }

/* Microinterações e acessibilidade leve */
.modal-close:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
  textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(232,165,89,0.15); border-color: var(--brand-accent); }

/* Radio group alinhado (já aplicado; reforço) */
.radio-group label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--brand-neutral-300); border-radius: 999px; padding: 8px 12px; min-height: 36px; line-height: 1; cursor: pointer; background: var(--brand-neutral-100); }
.radio-group label span { line-height: 1; display: inline-block; }
.radio-group label:hover { background: #E5E7EB; }
.radio-group input[type="radio"] { align-self: center; }

/* Cartões auxiliares */
.card { border: 1px solid #E5E7EB; border-radius: 8px; padding: 12px; background: #FFFFFF; }
.card-muted { background: #F9FAFB; }

/* Tipografia de apoio */
.label-strong { font-weight: 600; color: #111827; }
.text-muted { font-size: 12px; color: #6B7280; margin-top: 4px; }

/* Caixas de informação e alerta */
.info-box { border: 1px solid #D1FAE5; background: #ECFDF5; color: #064E3B; border-radius: 8px; padding: 10px; font-size: 12px; margin-top: 8px; }
.alert-box { border: 1px solid #FECACA; background: #FEF2F2; color: #7F1D1D; border-radius: 8px; padding: 10px; font-size: 12px; margin-top: 8px; }
.alert-warning { border-color: #FCD34D; background: #FFFBEB; color: #92400E; }

/* Barra de progresso global (consistente, sem flicker) */
#aiQuickIndicator { width: 100%; }
#aiQuickProgressBar {
  height: 3px;
  background: linear-gradient(90deg, #10B981, #e8a559);
  border-radius: 3px;
  width: 0%;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}
.progress-anim { animation: progressIndeterminate 1.2s ease-in-out infinite; }
@keyframes progressIndeterminate {
    0% { width: 10%; opacity: 0.6; }
    50% { width: 60%; opacity: 1; }
    100% { width: 90%; opacity: 0.7; }
}
.field label { display: block; font-size: 12px; color: #374151; margin-bottom: 4px; }
.field input, .field textarea { width: auto; min-width: 220px; padding: 8px; border: 1px solid #e5e7eb; border-radius: 8px; }
/* ========================================
   CARDS (padrão visual unificado)
   ======================================== */
:root {
    --card-bg: #ffffff;
    --card-border: #E5E7EB;
    --card-radius: 12px;
    --card-padding: 12px;
    --card-shadow: 0 0 0 rgba(0,0,0,0);
    --card-shadow-hover: 0 6px 16px rgba(17, 24, 39, 0.08);
    /* Variantes utilitárias */
    --card-padding-compact: 8px;
    --card-bg-muted: #F9FAFB;
    --card-shadow-strong: 0 12px 28px rgba(17, 24, 39, 0.14);
    --text-muted: #6B7280;
    /* Paleta neutra compartilhada */
    --neutral-100: #F3F4F6;
    --neutral-300: #E5E7EB;
    --neutral-900: #111827;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Utilitários de card */
.card-compact { padding: var(--card-padding-compact); }
.card-muted { background: var(--card-bg-muted); }
.card-hover-strong:hover { box-shadow: var(--card-shadow-strong); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-header .title {
    font-weight: 700;
    color: #374151;
}

.card-header .muted { font-size: 12px; color: var(--text-muted); }

/* Utilitário global de texto */
.muted { color: var(--text-muted); }

.card-body { /* Sem regras rígidas: container semântico */ }

/* ========================================
   SUBTÍTULO PADRÃO DE PÁGINA
   ======================================== */
.page-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    color: #374151;
    margin: 6px 0 12px;
}
.page-subtitle .icon {
    width: 20px;
    height: 20px;
    color: #374151;
    flex: 0 0 auto;
}
.page-subtitle .text { line-height: 1.2; }
@media (max-width: 640px) {
    .page-subtitle { font-size: 15px; }
    .page-subtitle .icon { width: 18px; height: 18px; }
}

/* ========================================
   WRAPPER SECTION TITLE (remover estilos inline)
   ======================================== */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Padrão de seções (trend-insights) — replicado do dashboard */
.trend-insights .section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.trend-insights .section-title h2, .trend-insights .section-title .title { margin: 0; }
.trend-insights .section-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Painel padrão reutilizável (cards de seção) */
.panel-card {
    background: transparent;
    border: none;
    border-radius: var(--card-radius);
    min-width: 0;
}
.panel-card-bg {
    background: var(--card-bg);
}
.panel-card-muted { background: var(--card-bg-muted); }

/* Seções com aparência de card (páginas de dashboard/index) */
.section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.section:hover { box-shadow: var(--card-shadow-hover); }

/* ========================================
   SEÇÕES POR PERÍODO (period-card)
   ======================================== */
.period-card {
    border: 1px solid var(--card-border, #e5e7eb);
    border-radius: var(--card-radius, 12px);
    margin: 12px;
    padding: var(--card-padding, 12px);
    background: var(--card-bg, #fff);
    transition: box-shadow .2s ease, border-color .2s ease;
}
.period-card:hover { box-shadow: var(--card-shadow-hover); }
.period-card.orange { border-color: #F59E0B; }
.period-card.green { border-color: #10B981; }
  .period-card.blue { border-color: #e8a559; }
.period-title {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.period-meta { color: #6B7280; font-size: 12px; }
.period-body {}
.period-card.collapsed .period-body { display: none; }

/* Itens dentro de period-card: tipografia e alinhamento (Radar) */
.period-card .item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.period-card .item a {
    color: #111827;
    text-decoration: none;
    font-weight: 600;
}
.period-card .item a:hover { text-decoration: underline; }
.period-card .item .meta,
.period-card .item div[style*="color:#6B7280"] {
    color: #6B7280;
    font-size: 12px;
}

/* ========================================
   LISTAS E ITENS (globais)
   ======================================== */
.list {
    background: #ffffff00;
    border: none;
    border-radius: var(--card-radius);
}

.list.compact .item { padding: var(--card-padding-compact); }

/* ========================================
   COMPONENTES: Toggle Card e Tag
   ======================================== */
.toggle-card {
    background: var(--neutral-100);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.toggle-card:hover { background: var(--neutral-300); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    background: var(--neutral-100);
    color: var(--neutral-900);
    border: 1px solid var(--neutral-300);
}
.tag-primary { background: rgba(232, 165, 89, 0.12); color: #92400E; border-color: rgba(232, 165, 89, 0.30); }
.tag-primary:hover { background: rgba(232, 165, 89, 0.20); }

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--card-padding);
    border-top: 1px solid var(--card-border);
}

.item.card-compact { padding: var(--card-padding-compact); }

.item:first-child { border-top: none; }

/* ========================================
   CHIPS E BADGES (globais)
   ======================================== */
/* Badges base e variantes */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--card-border);
    background: #fff;
    color: #374151;
}
.badge.blue { background: #EEF2FF; color: #3730A3; }
.badge.gray { background: #F3F4F6; color: #374151; }
.badge.green { background: #ECFDF5; color: #065F46; }
.badge.orange { background: #FFF7ED; color: #9A3412; }

.summary-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 6px;
    flex-wrap: wrap;
}
.summary-badges .badge {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

/* Badges de status */
.status-badge { padding: 6px 10px; border-radius: 14px; font-size: 12px; font-weight: 600; border: 1px solid var(--card-border); background: var(--status-bg, #F3F4F6); }
.new-badge { background: #D1FAE5; color: #065F46; border: 1px solid #10B981; }
/* Compactar somente o selo "Nova" sem afetar outras variantes */
.status-badge.new-badge { padding: 2px 6px; border-radius: 6px; }

/* Badge de contagem incremental (novas desde última atualização) */
.count-badge {
    background: #94bbc8;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

/* Grupo de chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.category-stats .chips { margin-top: 0; }

/* ========================================
   CONTAINER DE FILTROS (padrão Radar)
   ======================================== */
.filters {
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border, #e5e7eb);
    border-radius: var(--card-radius, 12px);
    padding: var(--card-padding, 12px);
    margin: 12px 0;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.filters:hover { box-shadow: var(--card-shadow-hover); }

/* Controles padrão de formulário (inputs/selects) */
.input, .select {
    padding: 8px 10px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    height: 36px;
    line-height: 20px;
}

/* Chip base: funciona para <span>, <a> e <button> */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 999px;
    font-size: 12px;
    background: #ffffff;
    color: #374151;
    text-decoration: none;
}

/* Variante compacta: mesma escala de .badge */
.chip-xs {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.2;
    border-radius: 10px;
    gap: 4px;
}

/* Variante: chip silencioso para baixa ênfase (rodapés, resumos) */
.chip-muted {
    background: #F3F4F6;
    border-color: #E5E7EB;
    color: #111827;
}

/* Variações de cor/uso */
.chip-geo { border-color: #93C5FD; }
.chip-cat { border-color: #6EE7B7; }
.chip-prop { border-color: #FDE68A; }
.chip-action { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: #F3F4F6; border-color: #D1D5DB; }
.chip-action:hover { background: #E5E7EB; }

/* Compatibilidade com chips existentes como links dentro de .chips */
.chips a {
    display: inline-block;
    margin: 4px 6px 0 0;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    color: #111827;
    text-decoration: none;
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chips a.active { background: #111827; color: #fff; border-color: #111827; }

/* ========================================
   TABELA PADRÃO (painéis)
   ======================================== */
.table-panel {
    width: 100%;
    table-layout: fixed;
    font-size: 14px;
    border-collapse: collapse;
}
.table-panel thead { background: #F3F4F6; color: #1F2937; }
.table-panel thead tr {
    font-size: 12px;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.table-panel th, .table-panel td { padding: 8px 12px; }
.table-panel tbody tr + tr { border-top: 1px solid var(--card-border); }
.table-panel tbody tr:hover { background: #F9FAFB; transition: background-color 120ms ease-in-out; }

/* ========================================
   UTILITÁRIAS DE LAYOUT (globais)
   ======================================== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.w-100 { width: 100%; }
.min-w-220 { min-width: 220px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ========================================
   COMPONENTES: TABS DE PERÍODO
   ======================================== */
.period-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.period-tab { padding: 10px 20px; border: 2px solid #E5E7EB; border-radius: 8px; background: white; font-weight: 600; cursor: pointer; }
.period-tab:hover { background: #F9FAFB; }
.period-tab.active { border-color: #D1D5DB; background: #F3F4F6; }

/* ========================================
   FILTROS E CARDS POR PERÍODO (Radar/Categoria)
   ======================================== */
/* Card de filtros (formulario compacto, igual ao Radar) */
.filters {
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border, #E5E7EB);
    border-radius: var(--card-radius, 12px);
    padding: var(--card-padding, 12px);
    margin: 12px 0;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.filters:hover { box-shadow: var(--card-shadow-hover); }

/* Card de seção por período (Última Hora, 24h, 7d) */
.period-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--card-border, #E5E7EB);
    border-radius: var(--card-radius, 12px);
    padding: var(--card-padding, 12px);
    transition: box-shadow .2s ease, border-color .2s ease;
}
.period-card:hover { box-shadow: var(--card-shadow-hover); }
.period-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; }
.period-meta { color: #6B7280; font-size: 12px; }

/* ========================================
   COMPONENTES: BOTÃO DE ÍCONE
   ======================================== */
.icon-btn { background: transparent; border: 1px solid #E5E7EB; border-radius: 8px; padding: 6px; line-height: 0; color: #374151; cursor: pointer; }
.icon-btn:hover { background: #F9FAFB; border-color: #D1D5DB; }

/* Filtros (chips interativos) */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-label { color: #6B7280; font-size: 13px; font-weight: 600; }
.filter-chip { padding: 6px 10px; border: 1px solid var(--card-border); border-radius: 14px; font-size: 12px; cursor: pointer; background: #fff; color: #374151; text-decoration: none; }
.filter-chip:hover { background: #F3F4F6; }
  .filter-chip.active { border-color: #e8a559; background: #FFF7ED; color: #B45309; }
/* Chevron minimalista para inputs/selects */
.with-chevron {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M2 1 L6 4 L2 7' stroke='%239AA0A6' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 14px 14px;
  padding-left: 44px; /* espaço maior para não sobrepor o texto */
}

/* Ajuste sutil para selects (padding menor) */
.with-chevron--select {
  background-image: none !important;
  padding-left: 16px;
}
/* Estilo unificado para botões IA (aplicar em .btn-ai e .btn-ai-quick) */
.btn-ia {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-ia .icon {
    width: 12px;
    height: 12px;
    display: block;
    margin: 0;
}

/* Fixação de altura e fonte para evitar qualquer redimensionamento visual */
.btn-ia-fixed {
    /* Altura/padding fixos garantem estabilidade desde o primeiro paint */
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    font-size: 12px;
    line-height: 1;
    box-sizing: border-box;
    /* Usa apenas fontes do sistema para não variar métricas quando webfonts carregam */
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
    /* Evita encolhimento em containers flex e mantém alinhamento */
    flex-shrink: 0;
}

/* ========================================
   COMPONENTES: STATUS TOGGLE (mobile)
   ======================================== */
/* Por padrão, o botão fica oculto no desktop para preservar o select */
.status-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    background: #FFFFFF;
    color: #374151;
    cursor: pointer;
}
.status-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.status-toggle .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #9AA0A6; /* cor neutra; JS ajusta dinamicamente */
    box-shadow: 0 0 0 1px rgba(17,24,39,0.12) inset;
}
.trend-actions .status-toggle { margin-left: 4px; }

/* Em telas até 768px, usamos o ícone e ocultamos o select original */
@media (max-width: 768px) {
    .trend-actions select[name="status_id"] { display: none !important; }
    .trend-actions .status-toggle { display: inline-flex; }
}

/* Layout base para barras de ações (Radar e cat=82) */
.trend-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Garantir visual escuro dos botões IA dentro do bloco trend-actions */
.trend-actions .btn.btn-secondary {
    background: #374151 !important;
    color: #fff !important;
    border-color: #374151 !important;
}

.trend-item.collapsed .domain-muted { display: none !important; }

/* Tamanhos compactos iguais ao Radar (altura 36px) */
.trend-actions .select {
    height: 36px;
    line-height: 20px;
    padding: 8px 10px;
    border-width: 1px; /* Radar usa 1px */
    border-radius: 8px;
    font-size: 14px;
    min-width: 180px; /* padronização de largura mínima, alinhada ao Radar */
}
.trend-actions .btn,
.trend-actions .btn.btn-sm {
    height: 36px;
    line-height: 20px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
}
/* Utilitários de layout comuns */
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.card { background: var(--card-bg, #fff); border: 1px solid var(--card-border, #e5e7eb); border-radius: var(--card-radius, 12px); padding: var(--card-padding, 12px); flex: 1; min-width: 280px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.link { display: inline-block; padding: 6px 10px; border-radius: 8px; border: 1px solid #e5e7eb; color: #111827; text-decoration: none; background: #fff; }

/* Componente Multi-select (dropdown com checkboxes) */
.multi-select { position: relative; min-width: 220px; }
.multi-select .ms-trigger { padding: 8px 10px; border: 1px solid #E5E7EB; border-radius: 8px; font-size: 14px; background: #fff; height: 36px; line-height: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; }
.multi-select .caret { font-size: 12px; color: #6B7280; }
.multi-select .ms-menu { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #E5E7EB; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.08); min-width: 220px; z-index: 30; padding: 8px; display: none; }
.multi-select.open .ms-menu { display: block; }
.multi-select .ms-option { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; user-select: none; }
.multi-select .ms-option:hover { background: #F3F4F6; }

/* =============================
   Destaque do link "Abrir link" (condicional)
   ============================= */
#aiOriginOpen.aiopen-hint {
    position: relative;
    border-radius: 6px;
    animation: aiopen-pulse 2.2s ease-out infinite;
}
#aiOriginOpen.aiopen-hint::after {
    content: '';
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 10px solid #10B981; /* seta apontando para a direita */
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.15));
    animation: aiopen-arrow-right 1.4s ease-in-out infinite;
}
@keyframes aiopen-pulse {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.35); }
    60% { box-shadow: 0 0 0 14px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@keyframes aiopen-arrow-right {
    0%   { right: -16px; opacity: 0.7; }
    50%  { right: -12px; opacity: 1; }
    100% { right: -16px; opacity: 0.7; }
}
/* ========================================
   MENU PADRÃO (NAV LIST)
   ======================================== */
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item { }
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151; /* slate-700 */
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.nav-link .icon { width: 18px; height: 18px; }
.nav-link:hover { background: #F3F4F6; /* slate-100 */ }
.nav-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35); /* azul foco */
}
.nav-link.is-active,
.nav-link[aria-current="page"] {
    background: #EFF6FF; /* blue-50 */
    color: #1E3A8A; /* blue-900 */
    border-color: #93C5FD; /* blue-300 */
}

@media (max-width: 768px) {
    .primary-nav .nav-list { flex-wrap: wrap; }
.primary-nav .nav-link { padding: 6px 10px; }
}
