:root {
    --primary: #1b4332;
    --primary-light: #2d6a4f;
    --accent: #10b981;
    /* Sincronizado com o portfólio */
    --accent-glow: rgba(16, 185, 129, 0.4);
    --bg-dark: #05080f;
    /* Mais profundo */
    --bg-panel: rgba(10, 15, 24, 0.9);
    --bg-chat: #0a0f18;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.06);
    --glow-shadow: none;
}

/* MURALHA DE ACESSO (SPLASH LOCK) */
.muralha-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #05080f;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
}

.muralha-overlay.unlocked {
    display: none !important;
}

.muralha-content {
    background: rgba(15, 23, 42, 0.95);
    padding: 40px 24px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.muralha-logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.muralha-logo {
    width: 80px;
    height: auto;
    margin-bottom: 16px;
}

.muralha-logo-area h2 {
    color: white;
    font-size: 22px;
    margin-bottom: 8px;
    letter-spacing: 1px;
    font-weight: 700;
}

.muralha-logo-area p {
    color: #94a3b8;
    font-size: 14px;
    margin-bottom: 24px;
}

.lock-input-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#muralha-pass, #muralha-login {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 16px;
    letter-spacing: 1px;
    outline: none;
    transition: all 0.3s;
}

#muralha-pass {
    letter-spacing: 3px;
}

#muralha-pass:focus, #muralha-login:focus {
    border-color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.btn-unlock {
    background: #10b981;
    color: #05080f;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-unlock:hover {
    background: #34d399;
    transform: translateY(-2px);
}

.muralha-error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-top: 16px;
    display: none;
}

.muralha-footer {
    margin-top: 40px;
    color: #475569;
}

.btn-unlock:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    /* Um pouco mais larga */
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    color: var(--accent);
}

.logo-area i {
    font-size: 32px;
}

.logo-area h1 {
    font-size: 26px;
    /* Mais imponente */
    font-weight: 700;
    color: white;
}

.brand-logo-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    animation: pulseGlow 4s infinite ease-in-out;
}

@keyframes pulseGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 0px transparent);
    }

    50% {
        filter: drop-shadow(0 0 10px var(--accent-glow));
    }
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item i {
    font-size: 20px;
    /* Tamanho ideal para ícones de navegação */
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background-color: var(--accent);
    color: var(--bg-dark);
    background-color: var(--accent);
    color: var(--bg-dark);
}

.sidebar-footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: auto;
}

.sidebar-footer p {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.sidebar-footer small {
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dark);
    min-width: 0;
    /* Impede que o conteúdo expanda o layout flex além do disponível */
    overflow: hidden;
}

.top-bar {
    padding: 24px 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.top-bar p {
    color: var(--accent);
    font-size: 14px;
}

.partner-badge {
    display: flex;
    align-items: center;
    /* Removido background e borda para o logo flutuar */
}

.brand-logo-top {
    height: 55px;
    max-width: 240px;
    object-fit: contain;
}

/* Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 20px 16px;
    overflow: hidden;
    min-width: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Scrollbar customization */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

.brand-seal {
    width: 100% !important;
    max-width: 220px !important;
    height: auto !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transition: all 0.3s ease;
}

.brand-seal:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.message {
    display: flex;
    gap: 16px;
    max-width: 90%;
    min-width: 0;
    animation: fadeIn 0.3s ease-out;
}

.message.ai {
    max-width: 95%;
    width: 95%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ai .avatar {
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    color: var(--bg-dark);
}

.user .avatar {
    background-color: var(--primary-light);
    color: white;
}

.bubble {
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    color: var(--text-main);
}

.ai .bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
    min-width: 0;
    overflow-x: hidden;
    word-break: break-word;
    flex: 1;
}

.user .bubble {
    background: var(--primary-light);
    border-top-right-radius: 4px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 14px; /* Respiro amplo para evitar 100% o corte da base no Windows/Webkit */
    scrollbar-width: none; /* Oculta a barra no Firefox */
    -ms-overflow-style: none; /* Oculta no IE/Edge */
}

.quick-actions::after {
    content: '';
    display: block;
    width: 32px; /* Garante que ao rolar até o final, o botão do Instagram tenha 32px de respiro lateral e não fique colado ou cortado na borda */
    flex-shrink: 0;
}

.quick-actions::-webkit-scrollbar {
    display: none; /* Oculta a barra grossa do Windows no Chrome/Edge/Safari */
}

/* Responsividade Desktop: Evita o clipping lateral e scrollbar oculta em telas grandes */
@media (min-width: 1024px) {
    .quick-actions {
        flex-wrap: wrap;
        overflow-x: visible;
        padding-bottom: 0;
    }
    .quick-actions::after {
        display: none;
    }
}

.quick-actions button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-actions button:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

/* Input Area */
.chat-input-area {
    margin-top: auto;
}

.input-wrapper {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.1);
    background: rgba(255, 255, 255, 0.08);
}

.input-wrapper textarea {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: white;
    font-size: 16px;
    outline: none;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

.input-wrapper button {
    background: var(--accent);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--bg-dark);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.input-wrapper button:hover {
    transform: scale(1.05);
    background: #6ce0ab;
}

#mic-btn {
    background: transparent !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border) !important;
    margin-right: 8px;
}

#mic-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: white !important;
}

#mic-btn.recording {
    background: #ff4757 !important;
    color: white !important;
    border-color: #ff4757 !important;
    animation: pulseMic 1.2s infinite alternate;
}

@keyframes pulseMic {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
    100% { transform: scale(1.1); box-shadow: 0 0 10px 4px rgba(255, 71, 87, 0); }
}

.chat-input-area small {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Painel de Controle (Dashboard Lado Direito) */
.dashboard-panel {
    width: 260px;
    flex-shrink: 0;
    background-color: #05100c;
    border-left: 1px solid var(--border);
    padding: 12px 10px; /* Reduzido de 16px 12px para liberar espaço */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduzido de 10px para 8px para compactação */
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
}

.dashboard-panel.risk-high-ambient {
    background-color: #1a0505;
    /* Vinho escuro para alerta máximo */
    box-shadow: -10px 0 50px rgba(239, 71, 111, 0.2);
}

.dashboard-panel.risk-med-ambient {
    background-color: #161205;
    /* Dourado escuro para alerta moderado */
}

.dash-header h3 {
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.satellite-indicator {
    font-size: 11px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin-bottom: 8px; /* Reduzido de 16px para 8px */
    opacity: 0.8;
}

.satellite-indicator.offline {
    color: #ffb703;
}

.satellite-indicator .pulse {
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 8px var(--accent);
}

.satellite-indicator .pulse.offline {
    background-color: #ffb703;
    box-shadow: 0 0 8px #ffb703;
}

.satellite-indicator .pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--accent);
    border-radius: 50%;
    animation: ripple 2s infinite;
}

.satellite-indicator .pulse.offline::after {
    background-color: #ffb703;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.dash-widget {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, background 0.2s;
}

.dash-widget:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.dash-widget i {
    font-size: 24px;
    color: var(--accent);
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dash-grid .dash-widget {
    flex-direction: column;
    text-align: center;
    gap: 8px;
}

.dash-widget.highlight {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-color: var(--accent);
}

.dash-widget.highlight i,
.dash-widget.highlight .widget-title,
.dash-widget.highlight .widget-value {
    color: white;
}

.demo-badge {
    background: rgba(239, 71, 111, 0.12) !important;
    border: 1px solid rgba(239, 71, 111, 0.3) !important;
    color: #ef476f !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: flash 1.5s infinite ease-in-out;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.widget-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.widget-value#dash-location {
    font-size: 1rem;
    line-height: 1.3;
}

/* Estados de Risco Dinâmicos - INTENSIFICADOS */
.dash-widget.risk-low {
    border-left: 4px solid #2d6a4f;
    background: rgba(45, 106, 79, 0.08);
}

.dash-widget.risk-med {
    border-left: 4px solid #f9c74f;
    background: rgba(249, 199, 79, 0.15);
    border-left: 4px solid #f9c74f;
    background: rgba(249, 199, 79, 0.15);
}

.dash-widget.risk-med i {
    color: #f9c74f;
    text-shadow: 0 0 10px rgba(249, 199, 79, 0.5);
}

.dash-widget.risk-high {
    border-left: 4px solid #ef476f;
    background: linear-gradient(90deg, rgba(239, 71, 111, 0.2) 0%, rgba(239, 71, 111, 0.05) 100%);
    border-left: 4px solid #ef476f;
    background: linear-gradient(90deg, rgba(239, 71, 111, 0.2) 0%, rgba(239, 71, 111, 0.05) 100%);
    animation: alertPulse 2s infinite;
}

.dash-widget.risk-high i {
    color: #ef476f;
    text-shadow: 0 0 12px rgba(239, 71, 111, 0.6);
}

@keyframes alertPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(239, 71, 111, 0.3);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 25px rgba(239, 71, 111, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(239, 71, 111, 0.3);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

/* Especial: Card de Risco Geral */
.dash-widget.risk-status {
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.dash-widget.risk-status.low {
    border-color: #52b78866;
    color: #52b788;
}

.dash-widget.risk-status.med {
    border-color: #f9c74f66;
    color: #f9c74f;
}

.dash-widget.risk-status.high {
    border-color: #ef476f88;
    color: #ef476f;
    background: rgba(239, 71, 111, 0.1);
}

/* Botão do WhatsApp (Dentro do Balão de Chat IA) */
.whatsapp-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.whatsapp-export-btn:hover {
    background-color: #128C7E;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transform: translateY(-2px);
}

.whatsapp-export-btn i {
    font-size: 18px;
}

/* Rodapé do Dashboard */
.dash-footer {
    margin-top: auto;
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.dash-footer small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Painel de Simulação */
.demo-controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px dashed var(--border);
}

.demo-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.demo-buttons {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.btn-demo {
    flex: 1;
    height: 36px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-demo:hover {
    transform: scale(1.1);
}

.btn-demo.calor {
    background: #ff9f1c;
}

.btn-demo.chuva {
    background: #118ab2;
}

.btn-demo.vento {
    background: #06d6a0;
}

.btn-demo.alegrete {
    background: #833ab4;
}

.btn-demo.reset {
    background: var(--border);
}

/* Botões Premium (Ação Rápida Predição) */
.quick-actions button.btn-premium {
    background: linear-gradient(135deg, #ffd70033, #ffb70366);
    border: 1px solid #ffd70088;
    color: #ffb703;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.1);
}

.quick-actions button.btn-premium:hover {
    background: linear-gradient(135deg, #ffd70066, #ffb703aa);
    color: #fff;
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

/* Tabelas Markdown Renderizadas no Chat */
.md-table-wrapper {
    margin: 12px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
}

.md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    table-layout: auto;
    min-width: 600px;
}

.md-table th {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 7px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: normal;
    line-height: 1.3;
    word-break: break-word;
}

.md-table td {
    padding: 7px 6px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: top;
    line-height: 1.4;
    font-size: 11px;
    text-align: center;
}

.md-table td:nth-child(2) {
    text-align: left;
    /* Clima alinhado à esquerda por ter texto descritivo */
}

/* Coluna Dia: ajustada ao conteúdo */
.md-table th:nth-child(1),
.md-table td:nth-child(1) {
    white-space: nowrap;
    width: auto;
}

/* Coluna Clima: flexível */
.md-table th:nth-child(2),
.md-table td:nth-child(2) {
    width: auto;
    min-width: 120px;
}

.md-table tr:last-child td {
    border-bottom: none;
}

.md-table tr:nth-child(even) td {
    background-color: rgba(255, 255, 255, 0.015) !important;
}

.md-table tr:nth-child(odd) td {
    background-color: transparent !important;
}

.md-table tr:hover td {
    background-color: rgba(82, 183, 136, 0.08) !important;
}

/* Títulos Markdown no Chat */
.md-h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 12px 0 6px;
    color: var(--accent);
}

.md-h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 10px 0 4px;
    color: var(--accent);
}

.md-h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 8px 0 4px;
    color: var(--text-muted);
}

.bubble p {
    margin: 4px 0;
}

.bubble strong, .highlight-welcome {
    color: white;
    font-weight: 600;
}

.bubble code {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Legenda automática das tabelas Premium */
.md-table-legend {
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    border-top: none;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    line-height: 1.5;
}

.legend-item {
    white-space: nowrap;
}

.legend-item strong {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   RESPONSIVO MOBILE — SHEARLINK SUMMIT GRAMADO EDITION
   ============================================================ */

/* --- Botão Hamburguer (apenas mobile) --- */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    line-height: 1;
    align-items: center;
    justify-content: center;
}

/* --- Botão painel clima (apenas mobile) --- */
.climate-toggle-btn {
    display: none;
    background: rgba(82, 183, 136, 0.15);
    border: 1px solid var(--accent-glow);
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    flex-shrink: 0;
    line-height: 1;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
}

/* --- Overlay escuro para drawers --- */
.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    backdrop-filter: blur(2px);
}

.drawer-overlay.active {
    display: block;
}

/* ============================================================
   TABLET (≤ 1024px) — esconde sidebar, mantém dashboard
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -220px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .top-bar {
        padding: 16px 20px;
    }

    .dashboard-panel {
        width: 240px;
    }
}

/* ============================================================
   MOBILE (≤ 768px) — layout totalmente empilhado
   ============================================================ */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    .app-container {
        flex-direction: column;
        height: 100dvh;
        /* dynamic viewport para celular */
    }

    /* Sidebar: drawer lateral */
    .sidebar {
        width: 240px;
        position: fixed;
        left: -260px;
        top: 0;
        height: 100%;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 20px 16px;
    }

    .sidebar.open {
        left: 0;
    }

    /* Dashboard: drawer de baixo pra cima */
    .dashboard-panel {
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        width: 100%;
        height: 75vh;
        max-height: 75vh;
        border-radius: 20px 20px 0 0;
        border-left: none;
        border-top: 1px solid var(--border);
        z-index: 100;
        transition: bottom 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
        padding: 20px 16px;
    }

    .dashboard-panel.open {
        bottom: 0;
    }

    /* Main content ocupa tudo */
    .main-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    /* Header mobile compacto */
    .top-bar {
        padding: 12px 16px;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .top-bar>div:first-child h2 {
        font-size: 17px;
        margin-bottom: 2px;
    }

    .top-bar>div:first-child p {
        font-size: 11px;
    }

    .partner-badge {
        margin-left: auto;
    }

    .brand-logo-top {
        height: 36px;
        max-width: 120px;
    }

    .hamburger-btn {
        display: flex;
        order: -1;
    }

    .climate-toggle-btn {
        display: flex;
    }

    /* Chat area */
    .chat-container {
        padding: 0 12px 12px;
        flex: 1;
        overflow: hidden;
    }

    .chat-messages {
        padding: 12px 0;
        gap: 16px;
    }

    .message {
        max-width: 100%;
        gap: 10px;
    }

    .message.ai {
        max-width: 100%;
        width: 100%;
    }

    .avatar {
        width: 32px;
        height: 32px;
        font-size: 18px;
        border-radius: 8px;
    }

    .bubble {
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 12px;
    }

    /* Ações rápidas no mobile */
    .quick-actions {
        gap: 8px;
        margin-bottom: 8px;
    }

    .quick-actions button {
        padding: 7px 12px;
        font-size: 12px;
        border-radius: 16px;
    }

    /* Input mobile */
    .input-wrapper {
        border-radius: 12px;
        padding: 6px;
        margin-bottom: 6px;
    }

    .input-wrapper textarea {
        padding: 10px 12px;
        font-size: 15px;
    }

    .input-wrapper button {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 18px;
    }

    .chat-input-area small {
        font-size: 10px;
    }

    /* Tabelas: scroll horizontal no mobile */
    .md-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .md-table {
        table-layout: auto;
        min-width: 480px;
        font-size: 11px;
    }

    .md-table th {
        font-size: 9px;
        padding: 6px 5px;
    }

    .md-table td {
        font-size: 10px;
        padding: 6px 5px;
    }

    /* Dashboard mobile handle */
    .dash-header {
        position: relative;
    }

    .dash-header::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: -8px auto 16px;
    }

    /* Botão WhatsApp mobile */
    .whatsapp-export-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* ============================================================
   MUITO PEQUENO (≤ 380px) — ajustes finos
   ============================================================ */
@media (max-width: 380px) {
    .top-bar>div:first-child h2 {
        font-size: 15px;
    }

    .brand-logo-top {
        height: 30px;
        max-width: 90px;
    }

    .bubble {
        font-size: 13px;
    }

    .quick-actions button {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* ============================================================
   MODAL API KEY
   ============================================================ */
.apikey-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 200;
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
}

.apikey-overlay.active {
    display: flex;
}

.apikey-modal {
    background: #1a222d;
    border: 1px solid rgba(82, 183, 136, 0.3);
    border-radius: 20px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(82, 183, 136, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.apikey-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent);
}

.apikey-modal-header i {
    font-size: 28px;
}

.apikey-modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

.apikey-modal p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.apikey-modal ol {
    color: var(--text-muted);
    font-size: 14px;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.apikey-modal ol a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.apikey-modal ol a:hover {
    text-decoration: underline;
}

#apikey-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 15px;
    font-family: monospace;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

#apikey-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.1);
}

.apikey-modal-actions {
    display: flex;
    gap: 10px;
}

.btn-save-key {
    flex: 1;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-save-key:hover {
    background: #6ce0ab;
    transform: translateY(-1px);
}

.btn-cancel-key {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-cancel-key:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.apikey-modal small {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
    line-height: 1.5;
}

/* --- REFATORAÇÃO DE DESIGN PREMIUM & DESPOLUIÇÃO --- */

/* Glassmorphism e Transparência Aprimorada */
.dash-widget {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px !important;
    padding: 10px 12px !important; /* Reduzido de 16px para economizar muito espaço vertical */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dash-widget:hover {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-2px);
}

/* Novo Layout Integrado de Clima */
.weather-integrated {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Reduzido de 16px para 10px */
}

.weather-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weather-header i {
    font-size: 24px;
    color: var(--accent) !important;
}

.location-info {
    display: flex;
    flex-direction: column;
}

.weather-details-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 12px;
    margin-top: 4px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.detail-item i {
    font-size: 18px;
    color: var(--text-muted);
}

.detail-item span {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.detail-item small {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item.temp-highlight i {
    color: #f97316; /* Laranja premium para calor */
}

.detail-item.temp-highlight span {
    color: #f97316;
}

#profile-status {
    font-size: 13px !important;
    font-weight: 600 !important;
}

/* Novo Card de Memória Integrado com Dossiê */
.profile-integrated {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduzido de 14px para 8px */
    cursor: pointer;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-header .avatar {
    width: 36px;
    height: 36px;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.profile-header .widget-content {
    display: flex;
    flex-direction: column;
}

.whatsapp-action-btn {
    width: 100%;
    background: rgba(37, 211, 102, 0.06);
    border: 1px solid rgba(37, 211, 102, 0.2);
    color: #25D366;
    padding: 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.whatsapp-action-btn:hover {
    background: #25D366;
    color: #05080f;
    border-color: #25D366;
    transform: translateY(-1px);
}

/* Minimalismo nas Sugestões de Chat */
.quick-actions button {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
    border-radius: 10px !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
}

.quick-actions button:hover {
    background: rgba(16, 185, 129, 0.06) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

.quick-actions button.btn-premium {
    background: rgba(249, 115, 22, 0.03) !important;
    border-color: rgba(249, 115, 22, 0.2) !important;
    color: #f97316 !important;
}

.quick-actions button.btn-premium:hover {
    background: rgba(249, 115, 22, 0.06) !important;
    border-color: #f97316 !important;
    color: white !important;
}

/* Botões de Simulação Subtis (Glassmorphic) */
.btn-demo {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    width: 36px;
    height: 36px;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-demo:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    transform: scale(1.05);
}

.btn-demo.calor:hover {
    border-color: #f97316 !important;
    color: #f97316 !important;
}

.btn-demo.chuva:hover {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

.btn-demo.vento:hover {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.btn-demo.reset:hover {
    border-color: #8b5cf6 !important;
    color: #8b5cf6 !important;
}

/* Estilização Premium para o Player de Áudio do Chat */
.bubble audio {
    display: block;
    margin-top: 6px;
    border-radius: 24px;
    outline: none;
    max-width: 250px;
    height: 40px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Widget de Cotações de Mercado --- */
.dash-widget.market-quotes {
    border-left: 4px solid var(--accent);
    background: rgba(82, 183, 136, 0.04);
}

.quote-item {
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid rgba(255, 255, 255, 0.02) !important;
    border-radius: 8px;
}

/* Ocultação do Container de Impressão de Laudos */
#print-report-container {
    display: none !important;
}