:root {
    --primary: #0f172a;
    --secondary: #1AB785;
    /* WM Soluções Teal */
    --accent: #38bdf8;
    --background: #f0f2f5;
    --surface: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --success: #38a169;
    --danger: #e53e3e;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
    overflow: hidden;
}

.navbar {
    background: #0f172a;
    /* Back to dark slate */
    color: white;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    height: 65px;
    box-sizing: border-box;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 900;
    text-decoration: none;
    color: white;
    letter-spacing: -0.02em;
}

.navbar-logo {
    height: 42px;
    /* Aumentado para visibilidade */
    width: auto;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--secondary);
}

/* Global User Profile Styles */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    margin-left: 10px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name-nav {
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.user-role-nav {
    font-size: 0.65rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.user-avatar-nav {
    width: 32px;
    height: 32px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .user-info {
        display: none;
    }
}

/* Toolbar Style - Simplified for Single Row */
.editor-toolbar {
    background: #ffffff;
    padding: 10px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    min-height: 80px;
    /* Thinner for one line */
    box-sizing: border-box;
    width: 100%;
}

.toolbar-scrollable-area {
    display: flex;
    flex-direction: row;
    /* Back to row */
    align-items: center;
    flex: 1;
    min-width: 0;
    /* Important for flex child scroll */
    gap: 20px;
}

.toolbar-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.toolbar-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.buttons-row {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 10px;
    width: 100%;
    scrollbar-width: thin;
}

.buttons-row::-webkit-scrollbar {
    height: 6px;
}

.buttons-row::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.save-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 20px;
    border-left: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0 25px;
    font-weight: 800;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    height: 50px;
    box-shadow: 0 4px 6px -1px rgba(56, 161, 105, 0.3);
    white-space: nowrap;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(56, 161, 105, 0.4);
}

.btn-setor-toggle {
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-setor-toggle.selected-sector-btn {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.4);
}

.btn-acao {
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    color: white !important;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Structural Layout */
.main-editor {
    display: flex;
    height: calc(100vh - 140px);
    /* Adjust to Navbar(60) + Toolbar(80) */
    background: #f8fafc;
    position: relative;
    width: 100%;
}

.editor-container {
    flex: 1;
    position: relative;
    background: white;
}

#canvas {
    width: 100%;
    height: 100%;
}

/* Ocultar Paleta Padrão e Ferramentas Flutuantes (Context Pad) */
.djs-palette,
.djs-context-pad,
.bjs-powered-by {
    display: none !important;
}

/* Properties Panel - Premium Redesign */
#properties-panel {
    width: 400px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    display: none;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    /* Scroll inside panel-body */
}

.panel-header {
    background: #ffffff;
    color: var(--primary);
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Accordion System */
.accordion-item {
    border-bottom: 1px solid #f1f5f9;
}

.accordion-header {
    padding: 16px 24px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #f8fafc;
}

.accordion-header h4 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.accordion-icon {
    font-size: 0.8rem;
    color: #cbd5e1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 24px 24px;
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s ease-out;
}

.accordion-item.active .accordion-content {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--primary);
    transition: all 0.2s;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* Multi-select/Checkbox Grid */
.check-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.check-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #f8fafc;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.check-group:hover {
    background: #ffffff;
    border-color: #e2e8f0;
}

.check-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--secondary);
    cursor: pointer;
}

.check-group span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
}

/* Premium Delete Button */
.panel-footer {
    padding: 24px;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
}

.btn-delete-premium {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid #fee2e2;
    background: #fffcfc;
    color: #ef4444;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-premium:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.2);
}

/* Modal de Ações Contextual */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: 24px;
    padding: 35px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 25px;
    animation: modalScale 0.3s ease-out;
}

@keyframes modalScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    text-align: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.modal-header p {
    margin: 8px 0 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.modal-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.btn-modal-acao {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 25px 15px;
    border-radius: 16px;
    border: 2px solid #f1f5f9;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-modal-acao:hover {
    border-color: var(--secondary);
    background: white;
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.1);
}

.btn-modal-acao .icon {
    font-size: 1.5rem;
}

.btn-modal-acao .name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary);
}

.btn-modal-acao .type-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-tramitacao {
    background: #dcfce7;
    color: #166534;
}

.badge-decisao {
    background: #fee2e2;
    color: #991b1b;
}

.modal-footer {
    display: flex;
    justify-content: center;
}

.btn-cancel {
    background: #f1f5f9;
    color: #475569;
    padding: 10px 25px;
    border-radius: 10px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

/* Dashboard Premium */
.hero {
    padding: 30px 0 50px 0;
    /* Reduced top padding */
    text-align: center;
    background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.05), transparent),
        radial-gradient(circle at bottom left, rgba(15, 23, 42, 0.02), transparent);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 20px;
    letter-spacing: -0.04em;
}

.hero p {
    font-size: 1.25rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.card-premium {
    background: white;
    border-radius: 32px;
    padding: 10px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-decoration: none;
}

.card-premium:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.1);
    border-color: var(--secondary);
}

.card-image-wrap {
    width: 100%;
    height: 200px;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    background: #f8fafc;
}

.card-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.card-premium:hover .card-image-wrap img {
    transform: scale(1.1);
}

.card-content {
    padding: 30px;
}

.card-premium h3 {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

.card-premium p {
    margin: 0 0 24px 0;
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary);
    font-weight: 700;
    font-size: 0.9rem;
}

.card-footer span {
    transition: transform 0.3s ease;
}

.card-premium:hover .card-footer span {
    transform: translateX(5px);
}



.wm-logo-filter {
    filter: brightness(0) invert(1);
    /* Makes the dark logo white */
    height: 22px;
    opacity: 0.9;
}


/* Premium Table and Grid Styles for CRUD Pages */
.container-premium {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.card-crud {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #f1f5f9;
}

.page-title {
    margin-bottom: 24px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.table-premium th {
    background: #f8fafc;
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #f1f5f9;
}

.table-premium td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.95rem;
    vertical-align: middle;
}

.table-premium tr:last-child td {
    border-bottom: none;
}

.table-premium tr:hover td {
    background: #fdfdfd;
}

/* Updated Button Styles for CRUD */
.btn-crud {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-save {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(26, 183, 133, 0.2);
}

.btn-save:hover {
    background: #17a377;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(26, 183, 133, 0.3);
}

.btn-clear {
    background: #f1f5f9;
    color: #475569;
}

.btn-clear:hover {
    background: #e2e8f0;
}

.btn-edit-small {
    padding: 6px 12px;
    background: #e0f2fe;
    color: #0ea5e9;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-delete-small {
    padding: 6px 12px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

[id^="lista-historico-"] {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #38bdf8 !important;
    /* Cor azul GestorFlow */
}



/* RESET TOTAL PARA PÁGINAS DE CADASTRO */
body.page-scrollable {
    overflow-y: auto !important;
    height: auto !important;
    display: block !important;
}

body.page-scrollable .container-premium {
    height: auto !important;
    min-height: 100vh !important;
    padding-bottom: 100px !important;
    display: block !important;
    overflow: visible !important;
}

/* Isso remove a trava de altura da sua Navbar se ela estiver forçando algo */
body.page-scrollable .navbar {
    flex-shrink: 0;
}

/* Estilo do Botão de Voltar no Modo Leitura */
.btn-voltar-premium {
    background-color: #3b82f6;
    /* Azul vibrante */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-voltar-premium:hover {
    background-color: #2563eb;
}






/* ==========================================================
   MODO LEITURA - BLOQUEIO TOTAL E CURSOR DE PROIBIDO
   ========================================================== */

/* 1. Alvo na camada de eventos e nos elementos do desenho */
.modo-leitura .djs-container,
.modo-leitura .djs-element,
.modo-leitura .djs-hit {
    pointer-events: none !important;
    /* Impede o clique */
}

/* 2. Força o cursor de bloqueado ao passar por cima do canvas */
.modo-leitura #canvas {
    pointer-events: auto !important;
    /* Permite que o mouse interaja com a área */
    cursor: not-allowed !important;
    /* Mostra o símbolo 🚫 */
}

/* 3. Trava os botões de setor no topo com cursor de bloqueado */
.modo-leitura .btn-setor-toggle,
.modo-leitura #btn-setores {
    pointer-events: none !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* 4. Esconde paleta e menu de edição */
.modo-leitura .djs-palette,
.modo-leitura .djs-context-pad {
    display: none !important;
}

/* 5. Trava o painel lateral */
.modo-leitura #properties-panel {
    pointer-events: none !important;
    cursor: not-allowed !important;
    background-color: #f1f5f9 !important;
}

/* 6. EXCEÇÕES (Navbar e Botão Voltar clicáveis) */
.modo-leitura .navbar,
.modo-leitura .btn-voltar-premium {
    pointer-events: auto !important;
    cursor: pointer !important;
}