/* ======================================================
   IA — Histórico de conversas
   ====================================================== */

.ia-hist-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.ia-hist-title { font-size: 30px; letter-spacing: -.6px; margin-bottom: 6px; }
.ia-hist-lead { font-size: 15px; color: #64748B; margin: 0; }

/* Segmented control de escopo */
.ia-hist-scope { display: flex; padding: 4px; background: rgba(15, 23, 42, .05); border-radius: 12px; }
.ia-hist-scope-btn {
    cursor: pointer; padding: 8px 16px; border-radius: 9px; border: none;
    font-size: 13px; font-weight: 600; font-family: var(--ia-font-ui);
    background: transparent; color: #64748B; transition: all .15s;
}
.ia-hist-scope-btn--active {
    background: #fff; color: #2563EB;
    box-shadow: 0 2px 8px -4px rgba(15, 23, 42, .3);
}
.ia-hist-scope-btn--disabled { opacity: .55; cursor: not-allowed; }

/* Filtros */
.ia-hist-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: center; }
.ia-hist-search { position: relative; flex: 1; min-width: 220px; }
.ia-hist-search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94A3B8; }
.ia-hist-search-input {
    width: 100%; padding: 11px 14px 11px 38px; border-radius: 12px;
    border: 1px solid var(--ia-border-2); background: rgba(255, 255, 255, .8);
    font-family: var(--ia-font-ui); font-size: 14px; outline: none; color: #0F172A;
}
.ia-hist-search-input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.ia-hist-select-wrap {
    display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 43px;
    border-radius: 12px; border: 1px solid var(--ia-border-2); background: rgba(255, 255, 255, .8);
}
.ia-hist-select {
    border: none; outline: none; background: transparent;
    font-family: var(--ia-font-ui); font-size: 14px; color: #475569; cursor: pointer;
}

/* Carregando / vazio */
.ia-hist-loading { display: flex; justify-content: center; padding: 50px 0; }
.ia-hist-spinner { width: 36px; height: 36px; border: 3px solid #e2e8f0; border-top-color: #2563EB; border-radius: 50%; animation: ia-hist-spin .6s linear infinite; }
@keyframes ia-hist-spin { to { transform: rotate(360deg); } }
.ia-hist-empty { text-align: center; padding: 50px 20px; color: #94A3B8; }
.ia-hist-empty i { font-size: 32px; display: block; margin-bottom: 12px; color: #cbd5e1; }
.ia-hist-empty p { margin: 0; font-size: 14px; }

/* Lista */
.ia-hist-list {
    border-radius: 18px; border: 1px solid var(--ia-border);
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    overflow: hidden; box-shadow: 0 10px 30px -20px rgba(15, 23, 42, .25);
}
.ia-hist-row {
    width: 100%; text-align: left; cursor: pointer;
    display: flex; align-items: center; gap: 16px; padding: 16px 20px;
    background: none; border: none; border-bottom: 1px solid rgba(15, 23, 42, .05);
    transition: background .15s;
}
.ia-hist-row:last-child { border-bottom: none; }
.ia-hist-row:hover { background: rgba(37, 99, 235, .04); }
.ia-hist-row-av { width: 42px; height: 42px; border-radius: 12px; }
.ia-hist-row-body { flex: 1; min-width: 0; }
.ia-hist-row-head { display: flex; align-items: center; gap: 8px; }
.ia-hist-row-title { font-family: var(--ia-font-display); font-size: 15px; font-weight: 700; color: #0F172A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ia-hist-row-pill { flex-shrink: 0; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.ia-hist-row-snippet { display: block; font-size: 13px; color: #64748B; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.ia-hist-row-meta { text-align: right; flex-shrink: 0; }
.ia-hist-row-date { display: block; font-size: 13px; font-weight: 600; color: #475569; }
.ia-hist-row-user { display: block; font-size: 12px; color: #94A3B8; margin-top: 2px; }
.ia-hist-row-chevron { flex-shrink: 0; }

@media (max-width: 575.98px) {
    .ia-hist-title { font-size: 24px; }
    .ia-hist-row { padding: 14px; gap: 12px; }
    .ia-hist-row-snippet { max-width: 180px; }
    .ia-hist-scope { width: 100%; }
    .ia-hist-scope-btn { flex: 1; }
}
