/* ============================================================
   WEBION CRM — Responsive CSS
   Target: 390px+ (iPhone 14 Pro, Galaxy S23, etc.)
   ============================================================ */

/* ===== PWA / APP-LIKE META ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    .top-header   { padding-top: env(safe-area-inset-top); }
    .main-content { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* ===== LARGE SCREENS (> 1400px) ===== */
@media (min-width: 1400px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr 420px; }
}

/* ===== MEDIUM-LARGE (1024px - 1399px) ===== */
@media (max-width: 1399px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr 360px; }
}

/* ===== TABLET (768px - 1023px) ===== */
@media (max-width: 1023px) {
    :root { --sidebar-w: 0px; }
    html, body { overflow-x: hidden; }
    .sidebar { transform: translateX(-240px); width: 240px; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.5); }
    .sidebar-close { display: block; }
    .sidebar-overlay.active { display: block; }
    .main-wrapper { margin-left: 0 !important; max-width: 100vw !important; overflow-x: hidden; }
    .hamburger { display: flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: repeat(2, 1fr); }
    .user-name { display: none; }
    .kanban-board { padding-bottom: 8px; }
}

/* ===== SMALL TABLET (600px - 767px) ===== */
@media (max-width: 767px) {
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-value { font-size: 1.5rem; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .filters-bar { gap: 8px; }
    .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; margin-top: auto; max-height: 90vh; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    table { font-size: 0.8rem; }
    thead th, tbody td { padding: 10px 12px; }
    .kanban-col { min-width: 240px; }
    .cal-day { min-height: 60px; }
    .cal-event { display: none; }
    .cal-day-num { font-size: 0.75rem; }
    .header-badge span { display: none; }
    .header-badge { padding: 6px 8px; }
    .page-title { font-size: 0.95rem; }
    .fin-summary-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== MOBILE (≤ 599px) — BASE PARA 390px ===== */
@media (max-width: 599px) {
    :root {
        --header-h: 56px;
        --sidebar-w: 0px;
    }

    /* === LAYOUT GERAL === */
    html, body { overflow-x: hidden !important; max-width: 100vw; }
    html { font-size: 14px; }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    .main-content {
        padding: 12px !important;
        gap: 14px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    /* Qualquer grid ou flex filho não pode transbordar */
    .main-content > * { max-width: 100%; box-sizing: border-box; }
    .stats-grid, .dashboard-grid, .fin-kpi-grid,
    .fin-resumo-grid, .kanban-board { max-width: 100%; }

    /* === HEADER === */
    .top-header { padding: 0 12px; gap: 6px; width: 100%; box-sizing: border-box; overflow: hidden; }
    .header-left { flex-shrink: 0; gap: 8px; min-width: 0; }
    .page-title { font-size: 0.88rem; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-right { gap: 3px; flex-shrink: 0; }
    .header-badge span { display: none; }
    .header-badge { padding: 5px 6px; border-radius: 50%; min-width: 0; }
    .user-name { display: none; }
    .user-info { padding: 4px 6px; }
    .user-avatar { width: 28px; height: 28px; font-size: 0.78rem; flex-shrink: 0; }

    /* Dropdown de notificações: largura total no mobile */
    .notif-dropdown {
        position: fixed;
        top: var(--header-h);
        left: 0; right: 0;
        width: 100%;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
        z-index: 300;
    }

    /* Dropdown de usuário — sobrescrever style inline */
    #userWrapper { position: static !important; }
    #userDropdown {
        position: fixed !important;
        top: var(--header-h) !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        border-radius: 0 0 var(--radius-xl) var(--radius-xl) !important;
        z-index: 9999 !important;
    }
    /* O chevron do userinfo: ocultar em mobile */
    #userInfoBtn .fa-chevron-down { display: none; }

    /* === SIDEBAR === */
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .hamburger { display: flex; }

    /* === SECTION HEADER === */
    .section-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .section-header h2 { font-size: 1rem; }
    .section-header .d-flex { gap: 6px; }
    .section-title { font-size: 1rem !important; }

    /* === CARDS === */
    .card { padding: 14px; border-radius: var(--radius-lg); overflow: hidden; max-width: 100%; }
    .card-header { margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
    .card-title { font-size: 0.88rem; }
    /* Gráfico: garantir que não transborde */
    .chart-container { overflow: hidden; max-width: 100%; }
    canvas { max-width: 100% !important; }

    /* === STATS GRID (dashboard) === */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 14px 12px; }
    .stat-value { font-size: 1.3rem; }
    .stat-icon { width: 34px; height: 34px; font-size: 0.95rem; margin-bottom: 8px; }
    .stat-label { font-size: 0.72rem; }

    /* === DASHBOARD GRID === */
    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }

    /* === FILTERS BAR === */
    .filters-bar {
        padding: 12px;
        gap: 8px;
        flex-direction: column;
        align-items: stretch;
    }
    .filters-bar .search-wrapper { width: 100%; }
    .filters-bar .filter-select { width: 100%; }
    .filters-bar .view-toggle { width: 100%; }
    .filters-bar .btn { width: 100%; justify-content: center; }
    /* Exceto o span de contagem */
    .filters-bar > span { width: auto !important; margin-left: 0 !important; }

    /* Linha de filtros em grid 2col quando possível */
    .filters-bar .filter-select,
    .filters-bar select { flex: 1; min-width: 0; }

    /* === TABELAS → CARD LAYOUT MOBILE === */
    /* Apenas tabelas dentro de .table-wrapper viram cards (evita quebrar fin-table etc) */
    .table-wrapper { overflow: visible; border-radius: var(--radius); }

    .table-wrapper table { font-size: 0.82rem; width: 100%; }
    .table-wrapper table thead { display: none; }
    .table-wrapper table tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        padding: 12px 12px 12px 16px;
        cursor: pointer;
        position: relative;
    }
    .table-wrapper table tbody tr:last-child { margin-bottom: 0; }
    .table-wrapper table tbody td {
        display: block;
        padding: 2px 0;
        border: none;
        text-align: left;
    }
    /* Coluna 1: indicador de prioridade — barra lateral */
    .table-wrapper table tbody td:nth-child(1) {
        position: absolute;
        top: 0; left: 0;
        width: 4px;
        height: 100%;
        padding: 0;
        border-radius: var(--radius) 0 0 var(--radius);
    }
    /* Coluna 2: título — destaque */
    .table-wrapper table tbody td:nth-child(2) {
        font-size: 0.88rem;
        font-weight: 600;
        padding-bottom: 5px;
    }
    /* Colunas 3,4: info secundária inline */
    .table-wrapper table tbody td:nth-child(3),
    .table-wrapper table tbody td:nth-child(4) {
        font-size: 0.75rem;
        color: var(--text-muted);
        display: inline;
    }
    .table-wrapper table tbody td:nth-child(4)::before { content: '  ·  '; }
    /* Coluna 5: vencimento */
    .table-wrapper table tbody td:nth-child(5) {
        font-size: 0.74rem;
        display: block;
        margin-top: 3px;
    }
    /* Coluna 6: status badge */
    .table-wrapper table tbody td:nth-child(6) {
        display: inline-block;
        margin-top: 5px;
    }
    /* Coluna 7: ações — canto superior direito */
    .table-wrapper table tbody td:nth-child(7) {
        position: absolute;
        top: 8px; right: 8px;
        padding: 0;
    }
    .table-wrapper table tbody td:nth-child(7) .d-flex { gap: 3px; }
    /* Row vencida: barra vermelha */
    .table-wrapper .row-vencida td:nth-child(1) { background: var(--danger); }
    .table-wrapper tbody tr:not(.row-vencida) td:nth-child(1) { background: rgba(255,255,255,0.06); }

    /* === FORMS === */
    .form-group { margin-bottom: 16px; }
    .form-row { grid-template-columns: 1fr; gap: 16px; }
    .form-row-3 { grid-template-columns: 1fr; gap: 16px; }
    .form-control { padding: 10px 12px; font-size: 0.9rem; }
    .form-label { font-size: 0.78rem; }

    /* === BOTÕES === */
    .btn { padding: 9px 14px; font-size: 0.85rem; }
    .btn-sm { padding: 7px 10px; font-size: 0.78rem; }
    .btn-lg { padding: 11px 20px; font-size: 0.9rem; }

    /* === MODAIS → BOTTOM SHEET === */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .modal {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        width: 100%;
        max-width: 100% !important;
        max-height: 92vh;
        margin: 0;
        /* handle bar no topo */
        padding-top: 4px;
    }
    /* Barra de arraste visual no topo do modal */
    .modal::before {
        content: '';
        display: block;
        width: 40px; height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 8px auto 0;
    }
    .modal-header { padding: 12px 18px; }
    .modal-title { font-size: 1rem; }
    .modal-body { padding: 16px 18px; }
    .modal-footer {
        padding: 12px 18px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .modal-footer .btn { flex: 1; justify-content: center; min-width: 120px; }

    /* Modal de configurações — abas em scroll horizontal */
    #modalConfiguracoes .modal { max-height: 95vh; }
    #modalConfiguracoes [style*="display:flex"][style*="border-bottom"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding: 0 12px;
    }
    #modalConfiguracoes [style*="padding:28px 32px"] { padding: 16px !important; }

    /* === FLASH MESSAGES === */
    .flash-msg { left: 10px; right: 10px; top: 64px; font-size: 0.85rem; }

    /* === KANBAN BOARD (Pipeline + Tarefas) === */
    .kanban-board {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
        gap: 10px;
        /* Snap para colunas */
        scroll-snap-type: x mandatory;
    }
    .kanban-col {
        min-width: 280px;
        max-width: 300px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }
    .kanban-board::-webkit-scrollbar { height: 3px; }
    .kanban-col-body { max-height: none; }
    .kanban-card { touch-action: pan-y; }

    /* === PAINEL LATERAL DE TAREFAS (task-painel) === */
    .task-painel {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        top: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
        z-index: 500 !important;
        overflow-y: auto;
    }
    .task-painel-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        padding: 12px 16px;
        border-top: 1px solid var(--border);
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .task-painel-footer .btn { flex: 1; justify-content: center; min-width: 100px; }

    /* === ROTINA === */
    .rotina-bloco { padding: 10px 12px; gap: 8px; overflow: hidden; }
    .rotina-hora { min-width: 36px; font-size: 0.74rem; flex-shrink: 0; }
    .rotina-nome { font-size: 0.84rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rotina-dur { font-size: 0.72rem; flex-shrink: 0; white-space: nowrap; }
    /* botão concluir bloco: só ícone */
    .rotina-bloco form .btn-sm { padding: 4px 7px; flex-shrink: 0; }
    .rotina-bloco form .btn-sm .fa-solid { margin: 0; }
    .rotina-cal { grid-template-columns: repeat(7, 1fr); gap: 2px; }
    .rotina-cal-day { font-size: 0.62rem; }
    .streak-badge { font-size: 0.78rem; padding: 5px 10px; }

    /* === FINANCEIRO === */
    .fin-summary-grid { grid-template-columns: 1fr; gap: 10px; }

    /* === PIPELINE CARDS === */
    .kanban-card-title { font-size: 0.88rem; }
    .kanban-card-sub { font-size: 0.78rem; }

    /* === BADGES === */
    .badge { font-size: 0.7rem; padding: 2px 8px; }

    /* === TABS (visualização lista/kanban) === */
    .tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tab-btn { padding: 10px 12px; font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
    .view-toggle { width: 100%; }
    .view-btn { flex: 1; justify-content: center; font-size: 0.8rem; }

    /* === ALERT / INFO BOXES === */
    .alert { padding: 10px 14px; font-size: 0.85rem; }

    /* === CALENDÁRIO === */
    .cal-grid { font-size: 0.78rem; }
    .cal-day { min-height: 52px; padding: 4px; }
    .cal-day-num { font-size: 0.72rem; }
    .cal-event { font-size: 0.65rem; padding: 1px 4px; }

    /* === POPUP (boas-vindas, follow-up) === */
    .popup-overlay { padding: 0; align-items: flex-end; }
    .popup-card {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        width: 100%;
        max-width: 100vw;
        max-height: 92vh;
        overflow-y: auto;
    }
    .popup-header { padding: 16px 16px 0; text-align: left; }
    .popup-header .logo-icon { width: 40px; height: 40px; font-size: 1.2rem; margin: 0 0 10px; }
    .popup-header h2 { font-size: 1.2rem; }
    .popup-header p { font-size: 0.82rem; }
    .popup-body { padding: 12px 16px; }
    /* Grid 2 colunas dentro do popup vira 1 coluna */
    .popup-body [style*="grid-template-columns:1fr 1fr"],
    .popup-body [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .popup-section { padding: 12px; margin-bottom: 10px; }
    .popup-section-title { font-size: 0.75rem; margin-bottom: 6px; }
    .popup-item { padding: 5px 0; gap: 8px; }
    .popup-item span[style*="font-size:0.82rem"] { font-size: 0.78rem !important; }
    .popup-num { font-size: 1.3rem; min-width: 36px; }
    .popup-footer { padding: 0 16px 16px; flex-direction: column; }
    .popup-footer .btn { width: 100%; justify-content: center; }

    /* === HIDE/SHOW === */
    .hide-mobile { display: none !important; }
    .show-mobile { display: flex !important; }

    /* === CLIENTES — painel lateral === */
    #painelCliente {
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        z-index: 500 !important;
    }

    /* === D-FLEX OVERRIDES para mobile === */
    .section-header .d-flex.gap-1 { flex-wrap: wrap; }

    /* === URGENTES (dashboard) === */
    .urgente-item { padding: 10px 12px; gap: 8px; flex-wrap: nowrap; }
    .urgente-info { min-width: 0; flex: 1; }
    .urgente-info strong { font-size: 0.82rem; white-space: normal; word-break: break-word; }
    .urgente-info small { font-size: 0.74rem; white-space: normal; }
    /* Botões de ação do urgente: compactar */
    .urgente-item > div[style*="display:flex"] { flex-shrink: 0; gap: 3px; }
    .urgente-item .btn-sm { padding: 5px 6px; }
    .urgente-item .btn-sm .fa-solid { margin: 0; }

    /* === ACTIVITY FEED === */
    .activity-item { padding: 8px 0; gap: 8px; flex-wrap: nowrap; align-items: flex-start; }
    .activity-text { flex: 1; min-width: 0; font-size: 0.82rem; word-break: break-word; }
    .activity-text strong { font-size: 0.82rem; }
    .activity-time { font-size: 0.7rem; white-space: nowrap; flex-shrink: 0; }

    /* === CSV DROP ZONE === */
    .csv-drop-zone { padding: 24px 16px; }

    /* === CONFIG TABS === */
    .config-tab-btn { padding: 10px 10px; font-size: 0.78rem; }
}

/* ===== 390px ESPECÍFICO — ajustes finos ===== */
@media (max-width: 430px) {
    /* Filtros da barra em 2 colunas onde faz sentido */
    .filters-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .filters-bar .search-wrapper { grid-column: 1 / -1; }
    .filters-bar > span { grid-column: 1 / -1; text-align: right; }
    .filters-bar .view-toggle { grid-column: 1 / -1; }
    .filters-bar .btn[href*="Limpar"],
    .filters-bar a.btn { grid-column: 1 / -1; }

    /* Stats em 2 colunas sempre */
    .stats-grid { grid-template-columns: 1fr 1fr; }

    /* Modal follow-up e detalhes do lead: ocupar tela toda */
    .modal { max-height: 95vh; }

    /* Kanban: col ligeiramente menor para dar dica de scroll */
    .kanban-col { min-width: 265px; }

    /* Botões de ação nas linhas da tabela: compactar */
    .d-flex.gap-1 { gap: 4px; }
    .d-flex.gap-1 .btn-sm { padding: 5px 7px; }
    .d-flex.gap-1 .btn-sm .fa-solid { margin: 0; }
}

/* ===== VERY SMALL (< 380px) ===== */
@media (max-width: 379px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { display: flex; align-items: center; gap: 12px; padding: 12px; }
    .stat-card::before { width: 100%; height: 3px; top: 0; left: 0; }
    .stat-icon { margin-bottom: 0; flex-shrink: 0; }
    .header-badge { display: none; }
    .kanban-col { min-width: 250px; }
}

/* ===== PRINT ===== */
@media print {
    .sidebar, .top-header, .popup-overlay, .notif-dropdown, .modal-overlay { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .main-content { padding: 0; }
    body { background: #fff; color: #000; }
    .card { border: 1px solid #ddd; box-shadow: none; }
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 16px;
}

.login-bg {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at 30% 30%, rgba(83,74,183,0.15) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 70%, rgba(29,158,117,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), var(--shadow-glow);
    animation: popupIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 60px; height: 60px; font-size: 1.8rem;
    margin: 0 auto 12px;
}

.login-logo h1 { font-size: 1.5rem; font-weight: 800; }
.login-logo p { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

.login-card .form-group { margin-bottom: 18px; }

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-error {
    background: rgba(224,59,59,0.15);
    border: 1px solid rgba(224,59,59,0.3);
    color: #f07070;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 479px) {
    .login-card { padding: 28px 20px; }
}

/* ===== FLOW BUILDER (automações) ===== */
.flow-canvas-wrapper {
    position: relative;
    overflow: hidden;
    background: var(--bg);
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: grab;
    touch-action: none;
}

.flow-canvas-wrapper.panning { cursor: grabbing; }

.flow-canvas {
    position: absolute;
    top: 0; left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.flow-node {
    position: absolute;
    min-width: 180px;
    max-width: 220px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: move;
    user-select: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.flow-node:hover, .flow-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(83,74,183,0.25);
}

.flow-node-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.flow-node-body { padding: 8px 12px; font-size: 0.78rem; color: var(--text-muted); }

.flow-port {
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-card);
    cursor: crosshair;
    transition: transform 0.15s;
    z-index: 10;
}

.flow-port:hover { transform: scale(1.5); }
.flow-port.input  { left: -6px;  top: 50%; transform: translateY(-50%); }
.flow-port.output { right: -6px; top: 50%; transform: translateY(-50%); }
.flow-port.output:hover { transform: translateY(-50%) scale(1.5); }

.flow-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ===== AUTOMACOES.CSS extras ===== */
.node-type-trigger  { border-top: 3px solid var(--secondary); }
.node-type-acao     { border-top: 3px solid var(--primary); }
.node-type-controle { border-top: 3px solid var(--warning); }
.node-type-delay    { border-top: 3px solid var(--info); }

.node-header-trigger  { background: rgba(29,158,117,0.15);  color: #4ecba4; }
.node-header-acao     { background: rgba(83,74,183,0.15);   color: var(--primary-light); }
.node-header-controle { background: rgba(240,165,0,0.15);   color: #f5be50; }
.node-header-delay    { background: rgba(59,159,224,0.15);  color: #7dc4ee; }

/* ===== WEBHOOK LOGS ===== */
.log-row-success { border-left: 3px solid var(--secondary); }
.log-row-error   { border-left: 3px solid var(--danger); }

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-dot.success { background: var(--secondary); }
.status-dot.error   { background: var(--danger); }
.status-dot.pending { background: var(--warning); }

/* ===== ROTINA STREAK ===== */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(240,165,0,0.15);
    border: 1px solid rgba(240,165,0,0.3);
    border-radius: 20px;
    color: #f5be50;
    font-size: 0.88rem;
    font-weight: 700;
}

.rotina-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.rotina-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.rotina-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ===== CALENDAR ROTINA (histórico) ===== */
.rotina-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.rotina-cal-day {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: default;
}

.rotina-cal-day.completo { background: rgba(29,158,117,0.25); color: #4ecba4; border-color: rgba(29,158,117,0.4); }
.rotina-cal-day.parcial  { background: rgba(240,165,0,0.25); color: #f5be50; border-color: rgba(240,165,0,0.4); }
.rotina-cal-day.falhou   { background: rgba(224,59,59,0.2);  color: #f07070; border-color: rgba(224,59,59,0.3); }
.rotina-cal-day.futuro   { opacity: 0.3; }

/* ===== FINANCIAL SUMMARY GRID ===== */
.fin-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

@media (max-width: 767px) {
    .fin-summary-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 479px) {
    .fin-summary-grid { grid-template-columns: 1fr; }
    .rotina-cal { grid-template-columns: repeat(7, 1fr); gap: 2px; }
    .kanban-board { gap: 8px; }
}

/* ===== DRAG-OVER state ===== */
.drag-over {
    background: rgba(83,74,183,0.1) !important;
    border-color: var(--primary) !important;
}

/* ===== IMPORTACAO CSV ===== */
.csv-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.csv-drop-zone:hover, .csv-drop-zone.active {
    border-color: var(--primary);
    background: rgba(83,74,183,0.08);
}

.csv-drop-zone .fa-solid { font-size: 2.5rem; color: var(--text-dim); margin-bottom: 12px; display: block; }
