/*
 * Tema "Acolhedor Moderno" (Opção 2) aplicado ao painel Filament.
 * Paleta e tokens extraídos de prototypes/layout-opcao-2-acolhedor-moderno.html.
 * Sem build (Vite/npm) neste projeto — arquivo estático publicado direto em public/css,
 * registrado via FilamentAsset::register() em AdminPanelProvider.
 */

:root {
    --gv-page: #faf8f4;
    --gv-surface: #ffffff;
    --gv-surface-2: #f3f0e9;
    --gv-text-primary: #231f16;
    --gv-text-secondary: #6b6355;
    --gv-text-muted: #9a9284;
    --gv-border: rgba(35, 31, 22, 0.08);
    --gv-accent: #1baf7a;
    --gv-accent-weak: #e2f6ed;
    --gv-accent-ink: #0f7a52;
    --gv-shadow-sm: 0 1px 3px rgba(35, 31, 22, 0.06);
    --gv-shadow-md: 0 8px 24px rgba(35, 31, 22, 0.08);
    --gv-radius-md: 16px;
    --gv-radius-lg: 22px;
    --gv-radius-xl: 28px;

    --gv-wa-fg: #0f7a52;
    --gv-wa-bg: #e2f6ed;
    --gv-sms-fg: #2a78d6;
    --gv-sms-bg: #e8f0fb;
    --gv-email-fg: #8a4fbf;
    --gv-email-bg: #f2e9fa;

    --gv-funnel-novo_contato: #8a8478;
    --gv-funnel-em_negociacao: #2a78d6;
    --gv-funnel-agendado: #c98500;
    --gv-funnel-convertido: #1baf7a;
    --gv-funnel-perdido: #d03b3b;

    --font-family: 'system-ui', -apple-system, 'Segoe UI', sans-serif !important;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --gv-page: #161510;
        --gv-surface: #221f18;
        --gv-surface-2: #2a271f;
        --gv-text-primary: #f7f4ec;
        --gv-text-secondary: #c7bfae;
        --gv-text-muted: #948c7c;
        --gv-border: rgba(247, 244, 236, 0.09);
        --gv-accent: #34c98c;
        --gv-accent-weak: #173327;
        --gv-accent-ink: #7fe0b5;
        --gv-wa-fg: #4fe0a3;
        --gv-wa-bg: #153b2c;
        --gv-sms-fg: #6ba6ec;
        --gv-sms-bg: #12263f;
        --gv-email-fg: #c3a0ef;
        --gv-email-bg: #2b1f3d;

        --gv-funnel-novo_contato: #a39c8c;
        --gv-funnel-em_negociacao: #6ba6ec;
        --gv-funnel-agendado: #e0a838;
        --gv-funnel-convertido: #34c98c;
        --gv-funnel-perdido: #e2685f;
    }
}

:root[data-theme='dark'] {
    --gv-page: #161510;
    --gv-surface: #221f18;
    --gv-surface-2: #2a271f;
    --gv-text-primary: #f7f4ec;
    --gv-text-secondary: #c7bfae;
    --gv-text-muted: #948c7c;
    --gv-border: rgba(247, 244, 236, 0.09);
    --gv-accent: #34c98c;
    --gv-accent-weak: #173327;
    --gv-accent-ink: #7fe0b5;
    --gv-wa-fg: #4fe0a3;
    --gv-wa-bg: #153b2c;
    --gv-sms-fg: #6ba6ec;
    --gv-sms-bg: #12263f;
    --gv-email-fg: #c3a0ef;
    --gv-email-bg: #2b1f3d;

    --gv-funnel-novo_contato: #a39c8c;
    --gv-funnel-em_negociacao: #6ba6ec;
    --gv-funnel-agendado: #e0a838;
    --gv-funnel-convertido: #34c98c;
    --gv-funnel-perdido: #e2685f;
}

body.fi-body {
    background-color: var(--gv-page);
    font-family: var(--font-family);
}

/* ---------- Sidebar ---------- */
.fi-sidebar {
    background-color: var(--gv-surface);
    border-inline-end-color: var(--gv-border);
}

.fi-sidebar-header {
    padding-block: 1.25rem;
}

.fi-sidebar-group-label {
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--gv-text-muted);
}

.fi-sidebar-item-btn {
    border-radius: 9999px;
    font-weight: 600;
    color: var(--gv-text-secondary);
}

.fi-sidebar-item-btn:hover {
    background-color: var(--gv-surface-2);
}

.fi-sidebar-group-btn {
    border-radius: 9999px;
    font-weight: 600;
    color: var(--gv-text-secondary);
}

.fi-sidebar-group-btn:hover {
    background-color: var(--gv-surface-2);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--gv-accent);
    color: #ffffff;
    box-shadow: var(--gv-shadow-sm);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-icon {
    color: #ffffff;
}

/* ---------- Topbar ---------- */
.fi-topbar-ctn .fi-topbar {
    background-color: var(--gv-surface);
    border-bottom: 1px solid var(--gv-border);
}

/* ---------- Cards / sections ---------- */
.fi-section {
    border-radius: var(--gv-radius-xl);
    border-color: var(--gv-border);
    box-shadow: var(--gv-shadow-sm);
}

.fi-section-content-ctn {
    background-color: var(--gv-surface);
}

.fi-section-header-heading {
    font-weight: 800;
}

/* ---------- Buttons ---------- */
.fi-btn {
    border-radius: 9999px;
    font-weight: 700;
    box-shadow: var(--gv-shadow-sm);
}

/* ---------- Badges ---------- */
.fi-badge {
    border-radius: 9999px;
    font-weight: 700;
}

/* ---------- Inputs ---------- */
.fi-input,
.fi-select-input {
    border-radius: var(--gv-radius-md);
}

/* ---------- Page wrapper ---------- */
.fi-main-ctn {
    background-color: var(--gv-page);
}

/* =====================================================================
   Central de Mensagens — visual de chat (estilo WhatsApp), portado de
   prototypes/layout-opcao-2-acolhedor-moderno.html (#view-mensagens)
   ===================================================================== */

.gv-icon {
    width: 18px;
    height: 18px;
    flex: none;
}

.gv-icon-sm {
    width: 14px;
    height: 14px;
}

.gv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gv-accent-weak);
    color: var(--gv-accent-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex: none;
}

.gv-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gv-surface);
    border: 1px solid var(--gv-border);
    border-radius: 9999px;
    padding: 9px 14px;
    color: var(--gv-text-muted);
    box-shadow: var(--gv-shadow-sm);
}

.gv-search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 13.5px;
    color: var(--gv-text-primary);
    width: 100%;
}

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

.gv-tag {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 9999px;
    background: var(--gv-surface);
    border: 1px solid var(--gv-border);
    color: var(--gv-text-secondary);
}

.gv-patient-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--gv-accent-ink);
    background: var(--gv-accent-weak);
    padding: 2px 8px;
    border-radius: 9999px;
}

.gv-unread-count {
    background: #eb6834;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.gv-channel-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.gv-channel-badge.wa {
    background: var(--gv-wa-bg);
    color: var(--gv-wa-fg);
}

.gv-channel-badge.sms {
    background: var(--gv-sms-bg);
    color: var(--gv-sms-fg);
}

.gv-channel-badge.email {
    background: var(--gv-email-bg);
    color: var(--gv-email-fg);
}

/* ---- shell ---- */
.gv-msgs-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: calc(100vh - 260px);
    min-height: 560px;
    border: 1px solid var(--gv-border);
    border-radius: var(--gv-radius-xl);
    overflow: hidden;
    background: var(--gv-surface);
    box-shadow: var(--gv-shadow-md);
}

@media (max-width: 980px) {
    .gv-msgs-shell {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* ---- conversation list pane ---- */
.gv-conv-list-pane {
    border-right: 1px solid var(--gv-border);
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--gv-surface-2);
}

.gv-conv-list-head {
    padding: 16px 14px 10px;
}

.gv-conv-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 0 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gv-conv-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px;
    cursor: pointer;
    border-radius: var(--gv-radius-md);
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
}

.gv-conv-item:hover {
    background: var(--gv-surface);
}

.gv-conv-item.selected {
    background: var(--gv-surface);
    box-shadow: var(--gv-shadow-sm);
}

.gv-conv-item.selected .gv-avatar {
    background: var(--gv-accent);
    color: #fff;
}

.gv-conv-main {
    min-width: 0;
    flex: 1;
}

.gv-conv-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.gv-conv-name {
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gv-conv-time {
    font-size: 11px;
    color: var(--gv-text-muted);
    flex: none;
}

.gv-conv-preview {
    font-size: 12.5px;
    color: var(--gv-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.gv-conv-item-badges {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---- thread pane ---- */
.gv-thread-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--gv-surface);
}

.gv-thread-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gv-border);
}

.gv-thread-head .gv-avatar {
    width: 42px;
    height: 42px;
    font-size: 14px;
}

.gv-thread-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--gv-text-primary);
}

.gv-thread-sub {
    font-size: 12px;
    color: var(--gv-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.gv-thread-sub a {
    color: var(--gv-accent-ink);
    font-weight: 700;
    text-decoration: none;
}

.gv-thread-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gv-select {
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 9999px;
    border: 1px solid var(--gv-border);
    background: var(--gv-surface-2);
    color: var(--gv-text-primary);
}

.gv-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    background: var(--gv-page);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gv-day-sep {
    align-self: center;
    font-size: 11px;
    color: var(--gv-text-muted);
    background: var(--gv-surface);
    border: 1px solid var(--gv-border);
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: 700;
}

.gv-msg-row {
    display: flex;
    gap: 8px;
    max-width: 66%;
}

.gv-msg-row.in {
    align-self: flex-start;
}

.gv-msg-row.out {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.gv-msg-row .gv-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
    margin-top: 2px;
}

.gv-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gv-msg-bubble {
    padding: 10px 13px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: var(--gv-shadow-sm);
    word-break: break-word;
}

.gv-msg-row.in .gv-msg-bubble {
    background: var(--gv-surface-2);
    border-bottom-left-radius: 5px;
    color: var(--gv-text-primary);
}

.gv-msg-row.out .gv-msg-bubble {
    background: var(--gv-accent);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.gv-msg-row.out.email .gv-msg-bubble {
    background: var(--gv-email-fg);
}

.gv-msg-row.falhou .gv-msg-bubble {
    background: var(--gv-surface-2);
    color: var(--gv-text-primary);
    border: 1.5px dashed #d03b3b;
}

.gv-msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: var(--gv-text-muted);
    padding: 0 4px;
}

.gv-msg-row.out .gv-msg-meta {
    justify-content: flex-end;
}

.gv-meta-channel {
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: 700;
}

.gv-ticks-read {
    color: var(--gv-accent-ink);
    font-weight: 800;
}

.gv-msg-failed {
    color: #d03b3b;
    font-weight: 700;
}

.gv-msg-media {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gv-media-thumb {
    width: 200px;
    max-width: 100%;
    height: 110px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--gv-surface-2), var(--gv-border));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gv-text-muted);
}

.gv-template-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.9;
    margin-bottom: 4px;
    display: block;
}

.gv-msg-scheduled {
    align-self: center;
    max-width: 84%;
}

.gv-msg-scheduled .gv-msg-bubble {
    background: var(--gv-surface);
    border: 1.5px dashed var(--gv-text-muted);
    color: var(--gv-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 14px;
}

.gv-window-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--gv-accent-ink);
    padding: 0 22px 10px;
    font-weight: 600;
}

.gv-window-hint::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gv-accent);
}

.gv-window-hint.outside {
    color: #c98500;
}

.gv-window-hint.outside::before {
    background: #c98500;
}

/* ---- composer ---- */
.gv-composer {
    border-top: 1px solid var(--gv-border);
    padding: 12px 20px 16px;
    background: var(--gv-surface);
}

.gv-composer .fi-fieldset {
    border: none;
    padding: 0;
}

.gv-composer-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.gv-send-btn {
    background: var(--gv-accent);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 9999px;
    font-size: 13.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--gv-shadow-sm);
}

.gv-send-btn:hover {
    background: var(--gv-accent-ink);
}

/* =====================================================================
   Relatório do Funil — cards de indicadores + visual em funil
   ===================================================================== */

.gv-stats-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 980px) {
    .gv-stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.gv-stat-card {
    background: var(--gv-surface);
    border: 1px solid var(--gv-border);
    border-radius: var(--gv-radius-lg);
    padding: 16px 18px;
    box-shadow: var(--gv-shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gv-stat-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gv-text-muted);
}

.gv-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--gv-text-primary);
    line-height: 1.15;
}

.gv-stat-hint {
    font-size: 11.5px;
    color: var(--gv-text-secondary);
}

.gv-stat-card.convertido .gv-stat-value {
    color: var(--gv-funnel-convertido);
}

.gv-stat-card.perdido .gv-stat-value {
    color: var(--gv-funnel-perdido);
}

.gv-stat-card.novo .gv-stat-value {
    color: var(--gv-funnel-novo_contato);
}

/* ---- funil ---- */
.gv-funnel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0 2px;
}

.gv-funnel-stage {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 24px;
    border-radius: var(--gv-radius-md);
    color: #fff;
    box-shadow: var(--gv-shadow-sm);
}

.gv-funnel-stage-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.95;
}

.gv-funnel-stage-count {
    font-size: 21px;
    font-weight: 800;
    white-space: nowrap;
}

.gv-funnel-connector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--gv-text-muted);
    padding: 6px 0;
}

.gv-funnel-connector .gv-icon-sm {
    color: var(--gv-text-muted);
    width: 12px;
    height: 12px;
}

.gv-duration-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
    margin-right: 8px;
}

.gv-duration-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.gv-duration-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--gv-text-muted);
    padding: 6px 8px;
}

.gv-duration-table td {
    padding: 10px 8px;
    color: var(--gv-text-primary);
    border-top: 1px solid var(--gv-border);
}

.gv-duration-table tbody tr:first-child td {
    border-top: none;
}
