/* Dashboard Specific Styles */
.dashboard-sidebar {
    background-color: var(--bg-sidebar);
}

.dash-nav {
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-item:hover {
    background-color: var(--bg-item-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-item-active);
    color: #1F74A8;
    font-weight: 600;
}

.dashboard-area {
    flex: 1;
    background-color: transparent;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: relative;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filters {
    display: flex;
    gap: 15px;
}

select {
    background: var(--planet-input);
    color: var(--text-primary);
    border: 1px solid transparent;
    padding: 8px 16px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
}

.kpi-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* Row-specific overrides for Desktop */
@media (min-width: 1024px) {
    .kpi-grid.row-4 { grid-template-columns: repeat(4, 1fr); }
    .kpi-grid.row-3 { grid-template-columns: repeat(3, 1fr); }
    .kpi-grid.row-1 { grid-template-columns: repeat(1, 1fr); }
}

.kpi-card {
    background: var(--planet-white);
    border: 1px solid var(--planet-border);
    border-radius: var(--planet-radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: var(--planet-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(24, 33, 77, 0.10);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Ícones dos KPIs: paleta Planet, uma cor por indicador */
.init-icon { background: rgba(48, 155, 218, 0.15); color: #1F74A8; }
.resp-icon { background: rgba(126, 193, 82, 0.18); color: #4F8A2C; }
.rate-icon { background: rgba(234, 175, 62, 0.18); color: #8F6512; }
.cal-icon { background: rgba(62, 68, 98, 0.12); color: #3E4462; }
.show-icon { background: rgba(126, 193, 82, 0.18); color: #4F8A2C; }
.noshow-icon { background: rgba(223, 72, 83, 0.15); color: #B8323D; }
.follow-icon { background: rgba(238, 124, 27, 0.15); color: #A8520C; }

.kpi-card h3 {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kpi-diff {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.diff-up { color: #4F8A2C; }
.diff-down { color: #B8323D; }
.diff-neutral { color: var(--text-secondary); }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--planet-white);
    border: 1px solid var(--planet-border);
    border-radius: var(--planet-radius-md);
    padding: 20px;
    box-shadow: var(--planet-shadow);
    position: relative;
    min-height: 350px;
}

.chart-card h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.dash-error {
    background: rgba(223, 72, 83, 0.2);
    color: #B8323D;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #DF4853;
    text-align: center;
}

/* ── Auditable KPI Cards ── */
.kpi-card.kpi-auditable {
    cursor: pointer;
    position: relative;
}

.kpi-card.kpi-auditable:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(48, 155, 218, 0.2);
    border-color: rgba(48, 155, 218, 0.4);
}

.audit-badge {
    font-size: 0.75rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.kpi-card.kpi-auditable:hover .audit-badge {
    opacity: 1;
}

/* ── Audit Modal Overlay ── */
.audit-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 33, 77, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.2s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.audit-modal {
    background: var(--planet-white);
    border: none;
    border-radius: 16px;
    display: flex;
    flex-direction: row;
    width: 500px;
    max-width: 96vw;
    max-height: 85vh;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    animation: slideUpModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.audit-modal.chat-open {
    width: min(960px, 96vw);
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Left Panel ── */
.audit-left-panel {
    width: 500px;
    min-width: 320px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

/* ── Right Panel: Inline Chat ── */
.audit-chat-panel {
    width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(0,0,0,0.07);
    background: #F5F5F7;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.audit-modal.chat-open .audit-chat-panel {
    width: 460px;
    max-width: 460px;
}

.audit-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.85);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
}

.audit-chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #309BDA;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.audit-chat-info {
    min-width: 0;
}

.audit-chat-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #18214D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-chat-phone {
    font-size: 0.78rem;
    color: #6D7288;
    margin-top: 2px;
}

.audit-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.audit-chat-messages::-webkit-scrollbar { width: 4px; }
.audit-chat-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }

.audit-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #8C8F94;
    gap: 10px;
    text-align: center;
    font-size: 0.85rem;
}

/* ── Inline Chat Bubbles ── */
.audit-bubble-wrapper {
    display: flex;
    margin-bottom: 2px;
}

.audit-bubble-wrapper.bot  { justify-content: flex-end; }
.audit-bubble-wrapper.user { justify-content: flex-start; }

.audit-bubble {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

.audit-bubble.bot {
    background: #E8F3FB;
    color: #18214D;
    border-bottom-right-radius: 3px;
}

.audit-bubble.user {
    background: #ffffff;
    color: #18214D;
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.audit-bubble-time {
    font-size: 0.68rem;
    color: #6D7288;
    text-align: right;
    margin-top: 3px;
}

.audit-date-divider {
    text-align: center;
    font-size: 0.72rem;
    color: #6D7288;
    margin: 10px 0 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 20px;
    padding: 3px 12px;
    align-self: center;
}

.audit-chat-loader {
    text-align: center;
    color: #6D7288;
    padding: 30px;
    font-size: 0.85rem;
}

.audit-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 22px 24px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

.audit-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #18214D;
    margin: 0 0 4px;
}

.audit-modal-subtitle {
    font-size: 0.82rem;
    color: #6D7288;
    margin: 0;
}

.audit-close-btn {
    background: rgba(0,0,0,0.06);
    border: none;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6D7288;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.audit-close-btn:hover {
    background: rgba(223, 72, 83, 0.12);
    color: #B8323D;
}

.audit-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: #6D7288;
}

.audit-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    font-family: inherit;
    color: #18214D;
}

.audit-search-bar input::placeholder {
    color: #8C8F94;
}

.audit-list-container {
    overflow-y: auto;
    flex: 1;
    padding: 10px 12px;
}

.audit-list-container::-webkit-scrollbar {
    width: 5px;
}

.audit-list-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.audit-loader {
    text-align: center;
    color: #6D7288;
    padding: 40px;
    font-size: 0.9rem;
}

.audit-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

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

.audit-item:hover {
    background: rgba(48, 155, 218, 0.1);
}

.audit-item.active {
    background: rgba(48, 155, 218, 0.18);
    border-left: 3px solid #309BDA;
}

.audit-item.active .audit-item-name {
    color: #1F74A8;
}

.audit-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: white;
    flex-shrink: 0;
}

.audit-avatar.init  { background: #309BDA; }
.audit-avatar.resp  { background: #7EC152; }
.audit-avatar.stage-avatar { background: var(--planet-primary); }

.audit-item-info {
    flex: 1;
    min-width: 0;
}

.audit-item-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #18214D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audit-item-phone {
    font-size: 0.78rem;
    color: #6D7288;
    margin-top: 2px;
}

.audit-item-date {
    font-size: 0.75rem;
    color: #8C8F94;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.audit-item-arrow {
    color: #8C8F94;
    font-size: 1rem;
    transition: color 0.15s, transform 0.15s;
}

.audit-item:hover .audit-item-arrow {
    color: #1F74A8;
    transform: translateX(3px);
}

.audit-empty {
    text-align: center;
    color: #8C8F94;
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* ── Audit Item Actions (Presence) ── */
.audit-actions {
    display: flex;
    gap: 8px;
    margin: 0 10px;
}

.audit-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    color: #6D7288;
}

.audit-btn.compareceu:hover, .audit-btn.compareceu.active {
    border-color: #7EC152;
    background: rgba(126, 193, 82, 0.1);
    color: #4F8A2C;
}

.audit-btn.faltou:hover, .audit-btn.faltou.active {
    border-color: #DF4853;
    background: rgba(223, 72, 83, 0.1);
    color: #B8323D;
}

/* Tooltip (Balloon) */
.audit-btn .tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: #18214D;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.audit-btn .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #18214D;
}

.audit-btn:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.audit-btn.compareceu .tooltip { background: #7EC152; }
.audit-btn.compareceu .tooltip::after { border-top-color: #7EC152; }

.audit-btn.faltou .tooltip { background: #DF4853; }
.audit-btn.faltou .tooltip::after { border-top-color: #DF4853; }


/* ════════════════════════════════════════════════════════════════════════
   GEO CHOROPLETH MAP
   ════════════════════════════════════════════════════════════════════════ */

.geo-map-card {
    min-height: unset;
    padding-bottom: 18px;
}

/* ── Header / Toolbar ── */
.geo-map-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.geo-map-title-area h3 {
    margin-bottom: 8px;
}

.geo-breadcrumb-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.geo-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid rgba(48, 155, 218, 0.35);
    border-radius: 20px;
    background: rgba(48, 155, 218, 0.08);
    color: #1F74A8;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.15s;
}

.geo-back-btn:hover {
    background: rgba(48, 155, 218, 0.18);
    border-color: rgba(48, 155, 218, 0.6);
    transform: translateX(-2px);
}

.geo-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
}

.geo-crumb-link {
    color: #1F74A8;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: opacity 0.15s;
}
.geo-crumb-link:hover { opacity: 0.7; }

.geo-crumb-sep {
    color: #8C8F94;
    font-size: 0.9rem;
}

.geo-crumb-current {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Metric Toggle Buttons ── */
.geo-metric-toggle {
    display: flex;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.geo-toggle-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.geo-toggle-btn.active {
    background: white;
    color: #1F74A8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.geo-toggle-btn:not(.active):hover {
    background: rgba(255,255,255,0.5);
    color: var(--text-primary);
}

/* ── Map Container ── */
.geo-map-container {
    width: 100%;
    background: rgba(245, 245, 247, 0.4);
    border-radius: 10px;
    overflow: hidden;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.geo-map-container svg {
    display: block;
}

/* Path hover is handled in JS via D3, but set base transition here */
.geo-path {
    transition: fill 0.25s ease;
}

/* ── State / Region Labels (rendered via D3) ── */
text.geo-uf-label {
    font-size: 12px;
    font-family: 'Noto Sans', sans-serif;
    font-weight: 800;
    fill: rgba(24, 33, 77, 0.95);
    pointer-events: none;
    /* halo branco atrás das letras para contraste em qualquer cor de fundo */
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 3.5px;
    stroke-linejoin: round;
    paint-order: stroke fill;
    letter-spacing: 0.3px;
}

text.geo-region-label {
    font-size: 13.5px;
    font-family: 'Noto Sans', sans-serif;
    font-weight: 700;
    fill: rgba(24, 33, 77, 0.92);
    pointer-events: none;
    /* halo branco — legível sobre qualquer intensidade do gradiente */
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 4px;
    stroke-linejoin: round;
    paint-order: stroke fill;
    letter-spacing: 0.2px;
}

/* ── Loading / Error States ── */
.geo-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 20px;
    color: #1F74A8;
    font-size: 0.88rem;
}

.geo-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(48, 155, 218, 0.25);
    border-top-color: #309BDA;
    border-radius: 50%;
    animation: geo-spin 0.75s linear infinite;
}

@keyframes geo-spin {
    to { transform: rotate(360deg); }
}

.geo-empty-state {
    color: #8C8F94;
    text-align: center;
    padding: 50px 20px;
    font-size: 0.88rem;
    line-height: 1.7;
}

/* ── Legend ── */
.geo-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 0 6px;
}

.geo-legend-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 28px;
    text-align: center;
}

.geo-legend-grad {
    flex: 1;
    height: 8px;
    border-radius: 20px;
    background: linear-gradient(to right, #DCEBF6, #18214D);
    transition: background 0.4s ease;
}

/* Quadradinho de cor para "zero" na legenda */
.geo-legend-zero-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #DCEBF6;
    border: 1px solid rgba(0,0,0,0.08);
    flex-shrink: 0;
}

/* ── Hint text ── */
.geo-hint {
    font-size: 0.74rem;
    color: #8C8F94;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
    font-style: italic;
}

/* ── Tooltip (appended to body) ── */
.geo-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(48, 155, 218, 0.25);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    max-width: 200px;
    animation: geo-tt-in 0.12s ease;
}

@keyframes geo-tt-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.geo-tt-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: #18214D;
    margin-bottom: 4px;
}

.geo-tt-metric {
    font-size: 0.72rem;
    color: #6D7288;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}

.geo-tt-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1F74A8;
}

/* ── Availability Management Styles ── */
.availability-table-container {
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.premium-table th {
    text-align: left;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.premium-table tbody tr {
    background: var(--planet-grey);
    transition: background 0.2s;
}

.premium-table tbody tr:hover {
    background: #E8F3FB;
}

.premium-table td {
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.premium-table td:first-child {
    border-left: 1px solid transparent;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    font-weight: 600;
}

.premium-table td:last-child {
    border-right: 1px solid transparent;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.in-stock {
    background: rgba(126, 193, 82, 0.15);
    color: #4F8A2C;
}

.status-badge.out-of-stock {
    background: rgba(223, 72, 83, 0.15);
    color: #B8323D;
}

.action-btns {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.05);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.action-btn.edit:hover {
    background: rgba(48, 155, 218, 0.1);
    color: #1F74A8;
    border-color: #309BDA;
}

.action-btn.delete:hover {
    background: rgba(223, 72, 83, 0.1);
    color: #B8323D;
    border-color: #DF4853;
}

/* Premium Form Styles */
.premium-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px; /* Reduzi um pouco para caber mais campos */
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.form-row.row-3 > .form-group {
    flex: 1;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.premium-form input, 
.premium-form select,
.premium-form textarea {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--planet-radius-sm);
    border: 1px solid transparent;
    background: var(--planet-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s;
}

/* File Upload Styles */
.file-upload-section {
    background: rgba(255, 255, 255, 0.3);
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-upload-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-upload {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-upload:hover {
    background: var(--planet-primary);
    color: white;
    border-color: var(--planet-primary);
}

.uploaded-files-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.file-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    background: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.file-card:hover {
    transform: scale(1.05);
}

.file-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-card .file-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.file-card .loading-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 5;
}

.file-name-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.65rem;
    padding: 3px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.file-card .loader-mini {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(48, 155, 218, 0.2);
    border-top-color: var(--planet-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-remove-card {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s;
}

.file-card:hover .btn-remove-card {
    opacity: 1;
}

.btn-remove-card:hover {
    background: #DF4853;
}

.upload-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-status.success { color: #4F8A2C; font-weight: 600; }
.upload-status.error { color: #B8323D; }
.upload-status.loading { color: var(--planet-primary); font-style: italic; }

.premium-form input:focus, 
.premium-form select:focus,
.premium-form textarea:focus {
    border-color: var(--planet-primary);
    box-shadow: 0 0 0 3px rgba(48, 155, 218, 0.1);
    background: white;
}

.btn-primary {
    background: var(--planet-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    letter-spacing: -0.4px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--planet-primary-hover);
}

.btn-secondary:hover {
    background: rgba(0,0,0,0.03);
}

/* Sales Funnel Card & Stage Styles */
.sales-funnel-card {
    margin-top: 25px;
    padding-bottom: 25px;
}

.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 15px;
    flex: 1;
    min-width: 320px;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 15px;
}

.funnel-stage-label {
    width: 200px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.funnel-stage-bar-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.05);
    height: 28px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.funnel-stage-bar {
    height: 100%;
    border-radius: 14px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.funnel-stage-value {
    width: 160px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.funnel-stage-count {
    font-weight: 700;
    color: var(--text-primary);
}

.funnel-stage-pct {
    font-size: 0.8rem;
    color: var(--planet-primary);
    background: rgba(48, 155, 218, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Funnel Sidebar and Standalone Cards Layout */
.funnel-layout-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 15px;
}

.funnel-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 280px;
    width: 280px;
}

.sidebar-card {
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    width: 100%;
}

.sidebar-card:hover {
    transform: translateY(-2px);
}

/* Broker Card Modifier */
.sidebar-card.broker-card {
    background: rgba(48, 155, 218, 0.08);
    border: 1px solid rgba(48, 155, 218, 0.2);
}

.sidebar-card.broker-card:hover {
    box-shadow: 0 6px 15px rgba(48, 155, 218, 0.12);
    border-color: rgba(48, 155, 218, 0.4);
}

.sidebar-card.broker-card .sidebar-card-icon {
    background: rgba(48, 155, 218, 0.15);
    color: #1F74A8;
}

/* Lost Card Modifier */
.sidebar-card.lost-card {
    background: rgba(223, 72, 83, 0.08);
    border: 1px solid rgba(223, 72, 83, 0.2);
}

.sidebar-card.lost-card:hover {
    box-shadow: 0 6px 15px rgba(223, 72, 83, 0.12);
    border-color: rgba(223, 72, 83, 0.35);
}

.sidebar-card.lost-card .sidebar-card-icon {
    background: rgba(223, 72, 83, 0.15);
    color: #B8323D;
}

/* Revenue Card Modifier */
.sidebar-card.revenue-card {
    background: rgba(126, 193, 82, 0.08);
    border: 1px solid rgba(126, 193, 82, 0.2);
}

.sidebar-card.revenue-card:hover {
    box-shadow: 0 6px 15px rgba(126, 193, 82, 0.12);
    border-color: rgba(126, 193, 82, 0.35);
}

.sidebar-card.revenue-card .sidebar-card-icon {
    background: rgba(126, 193, 82, 0.15);
    color: #4F8A2C;
}

.sidebar-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-card-info h4 {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-card-count {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 3px;
}

/* ── Sold Leads Modal Styles ── */
.sold-leads-modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    display: flex;
    flex-direction: row;
    width: 650px;
    max-width: 96vw;
    max-height: 85vh;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
    animation: slideUpModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sold-leads-modal.chat-open {
    width: min(1110px, 96vw);
}

.sold-leads-left-panel {
    width: 650px;
    min-width: 320px;
    max-width: 650px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sold-leads-modal.chat-open .audit-chat-panel {
    width: 460px;
    max-width: 460px;
}

.sold-leads-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    background: rgba(255, 255, 255, 0.8);
}

.sold-leads-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close-sold {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.btn-close-sold:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.sold-leads-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.sold-leads-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 60px 20px;
    color: var(--planet-primary);
    font-size: 0.95rem;
}

.sold-leads-error {
    background: rgba(223, 72, 83, 0.1);
    color: #B8323D;
    border: 1px solid rgba(223, 72, 83, 0.2);
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

.sold-leads-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Sold Lead Card */
.sold-lead-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sold-lead-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(48, 155, 218, 0.08);
    border-color: rgba(48, 155, 218, 0.25);
}

.sold-lead-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sold-lead-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sold-lead-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sold-lead-id {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.sold-lead-value-badge {
    background: rgba(126, 193, 82, 0.12);
    color: #4F8A2C;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sold-lead-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 4px;
}

.sold-lead-detail-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sold-lead-detail-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sold-lead-detail-val {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
}

.sold-lead-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.sold-lead-tag {
    background: rgba(48, 155, 218, 0.1);
    color: #1F74A8;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
}

.sold-lead-card.active {
    background: rgba(126, 193, 82, 0.05);
    border-color: rgba(126, 193, 82, 0.4);
    box-shadow: 0 6px 15px rgba(126, 193, 82, 0.08);
}

/* ── Treinamento e Objeções ── */
.training-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.training-search {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border-radius: var(--planet-radius-sm);
    border: 1px solid transparent;
    background: var(--planet-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
}

.training-search:focus {
    border-color: var(--planet-primary);
}

.training-count {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.training-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
}

.training-table td {
    vertical-align: top;
}

.training-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    max-width: 420px;
    line-height: 1.4;
}

.training-date {
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.training-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    font-weight: 400;
}

.training-badge {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(48, 155, 218, 0.15);
    color: var(--planet-primary);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.training-form textarea {
    resize: vertical;
}

.training-edit-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: rgba(48, 155, 218, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
}

.training-notice {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(234, 175, 62, 0.15);
    border: 1px solid rgba(234, 175, 62, 0.5);
    color: #8F6512;
    font-size: 0.9rem;
}

.training-error {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(223, 72, 83, 0.1);
    border: 1px solid #DF4853;
    color: #9E2A33;
    text-align: left;
}

.training-error-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.training-error-close {
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.training-error-diagnosis {
    margin: 8px 0;
    font-size: 0.92rem;
}

.training-error-details {
    margin: 0 0 10px;
    padding: 10px 12px;
    max-height: 180px;
    overflow: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    color: #6E1F26;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: text;
}

.training-error-copy {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #DF4853;
    background: white;
    color: #9E2A33;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ── Visualização de documentos (popup sobre o modal de disponibilidade) ── */
.file-card[role="button"] {
    cursor: pointer;
}

.file-card[role="button"]:focus-visible {
    outline: 3px solid rgba(48, 155, 218, 0.5);
    outline-offset: 2px;
}

.file-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100; /* acima do .audit-modal-overlay (1000) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(24, 33, 77, 0.7);
    animation: fadeInOverlay 0.2s ease;
}

.file-preview-box {
    width: min(1100px, 100%);
    height: min(88vh, 900px);
    display: flex;
    flex-direction: column;
    background: var(--planet-white);
    border-radius: var(--planet-radius-md);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--planet-border);
    flex-wrap: wrap;
}

.file-preview-heading {
    min-width: 0;
    flex: 1;
}

.file-preview-heading h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-note {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.file-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-preview-link {
    padding: 8px 14px;
    border-radius: var(--planet-radius-sm);
    border: 1px solid var(--planet-border);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}

.file-preview-link:hover {
    background: var(--planet-grey);
}

.file-preview-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--planet-grey);
    overflow: auto;
}

/* Imagem e vídeo sobre fundo escuro, como um visualizador de mídia */
.file-preview-body[data-kind="imagem"],
.file-preview-body[data-kind="video"] {
    background: var(--planet-dark);
}

.file-preview-body img,
.file-preview-body video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.file-preview-body audio {
    width: min(480px, 90%);
}

.file-preview-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--planet-white);
}

.file-preview-body pre {
    align-self: stretch;
    width: 100%;
    margin: 0;
    padding: 20px;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--planet-white);
}

.file-preview-message {
    max-width: 460px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.5;
}

.file-preview-message.error {
    background: rgba(223, 72, 83, 0.1);
    border: 1px solid #DF4853;
    border-radius: var(--planet-radius-sm);
    color: #B8323D;
}

.file-preview-message strong {
    display: block;
    margin-bottom: 6px;
}

.file-preview-message p + p {
    margin-top: 8px;
}

.file-preview-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

@media (max-width: 640px) {
    .file-preview-box {
        height: 92vh;
    }

    .file-preview-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
