:root {
    --bg-color: #f0f2f5;
    --sidebar-bg: #2c3e50;
    --card-bg: #ffffff;
    --color-new: #2ecc71;
    --color-sibs: #673ab7;
    --color-scml: #ff9800;
    --color-closed: #bbb;
    --color-accept: #3498db;
    --color-geral: #795548;
    --color-updated: #e67e22; /* Laranja para Updates */
    --ui-scale: 0.8;

    /* --- Novos tokens estruturais (tipografia, profundidade) --- */
    --font-ui: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;
    --ink: #1a1d24;
    --ink-soft: #6b7280;
    --hairline: #e7e9ee;
    --shadow-card: 0 1px 2px rgba(20,22,30,.05), 0 3px 8px -2px rgba(20,22,30,.06);
    --shadow-card-hover: 0 2px 4px rgba(20,22,30,.06), 0 6px 16px -4px rgba(20,22,30,.10);
    --shadow-modal: 0 24px 60px -12px rgba(10,12,18,.30), 0 8px 20px -6px rgba(10,12,18,.16);
    --radius-card: 7px;
    --radius-modal: 12px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body { 
    font-family: var(--font-ui); 
    margin: 0; 
    background: var(--bg-color);
    zoom: var(--ui-scale);
    /* Compensação do 'zoom': mantém a UI 20% menor mas a ocupar 100% da janela */
    width: calc(100vw / var(--ui-scale));
    height: calc(100vh / var(--ui-scale));
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
}

/* --- TOP BAR --- */
.top-bar { 
    height: 60px; 
    background: white; 
    border-bottom: 1px solid var(--hairline); 
    box-shadow: 0 1px 3px rgba(20,22,30,.04);
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 0 20px; 
    flex-shrink: 0; 
    z-index: 20; 
}

.left-section, .center-section, .right-section { display: flex; align-items: center; gap: 15px; }
.brand { font-weight: 700; letter-spacing: -.2px; font-size: 1.1em; color: var(--sidebar-bg); }

/* --- LAST SYNC LABEL --- */
.last-sync-label {
    font-size: 0.78em;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
    padding: 3px 9px;
    background: #f1f5f9;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.last-sync-label:hover {
    filter: brightness(0.96);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.last-sync-label.sync-ok {
    color: #166534;
    background: #f0fdf4;
    border-color: #86efac;
}
.last-sync-label.sync-warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fde68a;
    font-weight: 700;
}
.last-sync-label.sync-error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fca5a5;
    font-weight: 700;
}

/* --- FILTER COUNTERS --- */
.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    font-size: 0.8em;
    font-weight: 800;
    background: #e9ecef;
    color: #495057;
    border-radius: 9px;
    padding: 0 4px;
    margin-left: 2px;
    line-height: 1;
}

/* --- MENU AÇÕES (DROPDOWN) --- */
.actions-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-actions-menu {
    padding: 5px 10px;
    border: 1px solid #7f8c8d;
    background: white;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}
.btn-actions-menu:hover { background: #f3f3f3; }

.actions-dropdown {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    padding: 8px;
    z-index: 9999;
    min-width: 190px;
    display: none;
    flex-direction: column;
    gap: 6px;
}

.actions-menu.open .actions-dropdown { display: flex; }

.actions-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.actions-dropdown button {
    width: 100%;
    justify-content: flex-start;
}


/* --- PESQUISA --- */
.search-wrapper {
    position: relative; 
    display: flex;
    align-items: center;
}

.search-input {
    padding: 6px 35px 6px 12px; 
    border: 1px solid #ccc; 
    border-radius: 20px;
    width: 250px; 
    font-size: 0.9em; 
    transition: width 0.3s, background-color 0.3s; 
    background-color: #f9f9f9;
}

.search-input:focus { 
    width: 350px; 
    outline: none; 
    border-color: var(--color-accept); 
    background-color: #fff; 
}

/* Botão Limpar (X) */
.btn-clear-search {
    position: absolute; 
    right: 8px; 
    top: 50%;
    transform: translateY(-50%); 
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    z-index: 10; 
}
.btn-clear-search:hover { color: #e74c3c; background-color: rgba(0,0,0,0.1); }

/* Filtros */
.filters-area { display: flex; gap: 10px; font-size: 0.85em; font-weight: bold; color: #555; }
.view-switch button { padding: 6px 12px; margin: 0 2px; border: 1px solid #3498db; background: white; color: #3498db; cursor: pointer; border-radius: 4px; font-weight: 600; font-size: 0.9em; }
.view-switch button.active { background: #3498db; color: white; }

/* --- BOTÃO FOLLOW-UP E ALARME (CORREÇÃO FINAL) --- */
#btn-fu {
    /* Essencial para centrar texto e permitir badge absoluto */
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    position: relative !important; 
    overflow: visible !important; /* PERMITE O BADGE SAIR DO BOTÃO */
}

.alarm-badge {
    position: absolute !important;
    top: -10px !important;    /* Puxa para cima fora do botão */
    right: -10px !important;  /* Puxa para a direita fora do botão */
    
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e74c3c;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    border: 2px solid white;
    
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Animação do Glow */
@keyframes neon-pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); border-color: #e74c3c; }
    50% { box-shadow: 0 0 15px 4px rgba(231, 76, 60, 0.9); border-color: #ff0000; }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); border-color: #e74c3c; }
}

/* Quando tem alarme */
#btn-fu.has-alarm {
    color: #e74c3c !important;
    border: 1px solid #e74c3c !important;
    animation: neon-pulse 1.2s infinite ease-in-out !important;
    font-weight: bold;
}

/* Quando está ativo e com alarme (mantém glow) */
#btn-fu.has-alarm.active {
    background-color: #e74c3c !important;
    color: #fff !important;
}

/* Quando estamos na vista Follow-up: botão a vermelho */
#btn-fu.active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}


/* --- SIDEBAR --- */
.main-container { display: flex; flex-grow: 1; overflow: hidden; position: relative; }

.sidebar { 
    width: 360px; /* Largura Aumentada */
    box-sizing: border-box; 
    background: var(--sidebar-bg); 
    color: white; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
    position: relative; 
    overflow: visible; 
    transition: margin-left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-left: 0;
    border-right: none; 
    z-index: 5;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1); 
}

.sidebar-content {
    width: 100%;
    box-sizing: border-box;
    padding: 15px;
    padding-right: 45px;
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 50px; 
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Edge legacy */
}
.sidebar-content::-webkit-scrollbar { display: none; } /* Chrome/Safari/Edge Chromium */

.sidebar.collapsed { 
    margin-left: -360px; /* Tem de ser o oposto da largura */
}

.sidebar h2 { font-size: 0.95em; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; margin: 0 0 15px 0; }
.sidebar.collapsed .sidebar-content { opacity: 0; pointer-events: none; }


/* --- SIDEBAR HANDLE (ABA) --- */
#handle-text {
    writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg);
    letter-spacing: 2px; text-transform: uppercase; font-size: 0.85em; white-space: nowrap;
}
#handle-icon { font-size: 1.2em; margin-bottom: 5px; }

.handle-badge {
    background: #e74c3c; color: white; font-size: 0.8em; padding: 2px 5px; border-radius: 4px;
    min-width: auto; writing-mode: horizontal-tb; position: absolute; top: 10px; left: 50%;
    transform: translateX(-50%); box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar-handle {
    position: absolute; top: 120px; right: -1px; width: 35px; height: 160px;
    background: linear-gradient(to left, rgba(0,0,0,0.15), var(--sidebar-bg)); 
    border: none; border-radius: 15px 0 0 15px;
    cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; color: rgba(255,255,255,0.6); font-weight: bold; z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-handle:hover { color: white; }

.sidebar-handle::before, .sidebar-handle::after {
    content: ''; position: absolute; right: 0; width: 20px; height: 20px; background: transparent; z-index: 1; pointer-events: none;
}
.sidebar-handle::before { top: -20px; border-bottom-right-radius: 50%; box-shadow: -5px 5px 0 0 var(--sidebar-bg); }
.sidebar-handle::after { bottom: -20px; border-top-right-radius: 50%; box-shadow: -5px -5px 0 0 var(--sidebar-bg); }

/* Estado FECHADO */
.sidebar.collapsed .sidebar-handle {
    right: -35px; background: var(--sidebar-bg); border-radius: 0 15px 15px 0; box-shadow: 4px 0 8px rgba(0,0,0,0.15);
}
.sidebar.collapsed .sidebar-handle:hover { background: #34495e; }
.sidebar.collapsed .sidebar-handle::before { right: auto; left: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 50%; box-shadow: 0 10px 0 0 var(--sidebar-bg); }
.sidebar.collapsed .sidebar-handle::after { right: auto; left: 0; border-top-right-radius: 0; border-top-left-radius: 50%; box-shadow: 0 -10px 0 0 var(--sidebar-bg); }

/* Animação Alerta da Aba */
@keyframes blink-text { 0%, 100% { color: rgba(255,255,255,0.6); } 50% { color: #e74c3c; text-shadow: 0 0 5px rgba(231, 76, 60, 0.5); } }
.sidebar-handle.blink-alert #handle-text, .sidebar-handle.blink-alert #handle-icon { animation: blink-text 1.5s infinite; color: white; }


/* --- BOARD AREA --- */
.board-area { 
    flex-grow: 1; 
    overflow-x: auto; 
    display: flex; 
    background: #e9ecef;
    padding-left: 30px; /* Espaço extra à esquerda para não colidir com a aba */
}
.kanban-board { display: flex; padding: 15px; gap: 12px; min-width: 100%; box-sizing: border-box; }

.column-wrapper { background: #dee2e6; border-radius: 6px; min-width: 280px; flex: 1; display: flex; flex-direction: column; }
.column-wrapper h3 { padding: 10px; font-size: 0.75em; color: #495057; text-transform: uppercase; margin: 0; font-weight: bold; }
.kanban-column { padding: 8px; flex-grow: 1; overflow-y: auto; min-height: 100px; }


/* --- REMOVIDOS (PRs que deixaram de vir no snapshot) --- */
.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.15);
    margin: 14px 0;
}
.sidebar-header-removed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.removed-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.removed-item {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 10px;
    font-size: 0.85em;
}
.removed-item .rid { font-weight: bold; }
.removed-item .meta {
    margin-top: 6px;
    opacity: 0.85;
    font-size: 0.8em;
    line-height: 1.35;
}


/* Fallback para browsers sem 'zoom' (ex.: Firefox) */
@supports not (zoom: 1) {
    body {
        transform: scale(var(--ui-scale));
        transform-origin: top left;
        width: calc(100vw / var(--ui-scale));
        height: calc(100vh / var(--ui-scale));
    }
}

/* --- FOOTER --- */
.app-footer {
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    border-top: 1px solid #ddd;
    font-size: 0.72em;
    color: #95a5a6;
    letter-spacing: 0.3px;
    user-select: none;
}
.footer-sep { opacity: 0.5; }
.footer-version {
    font-weight: 700;
    color: #7f8c8d;
    background: #f0f2f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 0 5px;
}
