/**
 * STALO COMPONENTS - Estilos Padronizados
 * Arquivo de componentes reutilizáveis para todas as páginas do sistema
 */

/* ========== VARIÁVEIS DE CORES ========== */
:root {
    --stalo-primary: #362d4b;
    --stalo-primary-dark: #2a2339;
    --stalo-primary-light: #4a3f66;
    --stalo-secondary: #ff3c01;
    --stalo-secondary-dark: #e63500;
    --stalo-bg-light: #ffffff;
    --stalo-bg-sidebar: #f8f9fa;
    --stalo-text-dark: #1a1a2e;
    --stalo-text-muted: #6c757d;
    --stalo-border-color: #e9ecef;
    --stalo-sidebar-width: 240px;
    --stalo-header-height: 64px;
}

/* ========== HEADER MODERNO ========== */
#header.header {
    background: var(--stalo-bg-light) !important;
    height: var(--stalo-header-height);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid var(--stalo-border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
}

#header .navbar-header {
    background: transparent;
    width: var(--stalo-sidebar-width);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: var(--stalo-header-height);
    flex-shrink: 0;
}

#header .navbar-brand {
    padding: 0 !important;
    height: auto;
    display: flex;
    align-items: center;
}

#header .navbar-brand img {
    height: 34px;
    width: auto;
    transition: transform 0.2s ease;
}

#header .navbar-brand:hover img {
    transform: scale(1.02);
}

/* Toggle Button Mobile - Cor Primária */
#header .navbar-toggle {
    background: var(--stalo-primary) !important;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 0;
    margin-left: auto;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(54, 45, 75, 0.3);
}

#header .navbar-toggle:hover,
#header .navbar-toggle:focus {
    background: var(--stalo-primary-dark) !important;
    box-shadow: 0 4px 12px rgba(54, 45, 75, 0.4);
}

#header .navbar-toggle .icon-bar {
    background: #ffffff !important;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    transition: all 0.2s ease;
}

#header .navbar-toggle .icon-bar + .icon-bar {
    margin-top: 5px;
}

/* Navbar Right - User Menu - Centralizado Verticalmente */
#header .navbar-nav.navbar-right {
    display: flex !important;
    align-items: center !important;
    height: var(--stalo-header-height) !important;
    margin: 0 24px 0 auto !important;
    padding: 0 !important;
    float: none !important;
    position: absolute;
    right: 0;
    top: 0;
}

#header .navbar-nav.navbar-right > li {
    display: flex !important;
    align-items: center !important;
    height: 100%;
    float: none !important;
}

#header .navbar-nav.navbar-right > li > a {
    display: flex !important;
    align-items: center !important;
    height: auto !important;
    padding: 10px 16px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

/* User Dropdown Específico */
#header .navbar-user {
    position: relative;
}

#header .navbar-user > a {
    color: var(--stalo-text-dark) !important;
    font-weight: 500;
    padding: 10px 16px !important;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    font-size: 14px;
    background: var(--stalo-bg-sidebar);
    border: 1px solid var(--stalo-border-color);
}

#header .navbar-user > a:hover {
    background: var(--stalo-border-color);
    border-color: #ced4da;
}

#header .navbar-user > a .fa-user-circle {
    font-size: 12px;
    color: var(--stalo-primary);
    margin-right: 5px;
}

#header .navbar-user > a .caret {
    opacity: 0.5;
    margin-left: 4px;
}

#header .navbar-user .dropdown-menu {
    background: #fff;
    border: 1px solid var(--stalo-border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    margin-top: 8px;
}

#header .navbar-user .dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
}

#header .navbar-user .dropdown-menu .dropdown-item {
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--stalo-text-dark);
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

#header .navbar-user .dropdown-menu .dropdown-item:hover {
    background: var(--stalo-primary);
    color: #fff;
}

#header .navbar-user .dropdown-menu .dropdown-divider {
    margin: 8px 0;
    border-color: var(--stalo-border-color);
}

.page-header-fixed {
    padding-top: 0;
}

.pace-progress {
    top: 55px;
}

/* ========== SIDEBAR MODERNO ========== */
#sidebar.sidebar,
.sidebar-bg {
    width: var(--stalo-sidebar-width) !important;
    background: var(--stalo-bg-light) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
    border-right: 1px solid var(--stalo-border-color);
}

#sidebar.sidebar {
    padding-top: calc(var(--stalo-header-height) + 20px) !important;
}

/* Scrollbar do Sidebar */
#sidebar [data-scrollbar="true"] {
    height: calc(100vh - var(--stalo-header-height)) !important;
}

#sidebar::-webkit-scrollbar,
#sidebar [data-scrollbar="true"]::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track,
#sidebar [data-scrollbar="true"]::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#sidebar [data-scrollbar="true"]::-webkit-scrollbar-thumb {
    background: var(--stalo-border-color);
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover,
#sidebar [data-scrollbar="true"]::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}

/* Nav Profile - Oculto no desktop (visível no mobile) */
#sidebar .nav > li.nav-profile {
    display: none !important;
}

/* Menu do perfil (Editar, Sair) - Oculto no desktop */
#sidebar .nav > li.nav-profile + li {
    display: none !important;
}

/* Esconder ul.nav.nav-profile no desktop */
#sidebar ul.nav.nav-profile,
.sidebar .nav.nav-profile {
    display: none !important;
}

/* Nav Header */
#sidebar .nav > li.nav-header {
    color: var(--stalo-text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 24px 16px 10px;
    margin-top: 0;
    display: none;
}

/* Nav Items */
#sidebar .nav {
    padding: 0 12px !important;
    margin-top: 0 !important;
}

#sidebar .nav > li {
    margin-bottom: 2px;
}

#sidebar .nav > li > a {
    color: var(--stalo-text-dark) !important;
    padding: 11px 0 11px 15px;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0;
    transition: all 0.2s ease;
    background: transparent;
    margin: 0;
}

#sidebar .nav > li > a:hover {
    background: var(--stalo-bg-sidebar) !important;
    color: var(--stalo-primary) !important;
}

#sidebar .nav > li > a i {
    width: 20px;
    font-size: 16px !important;
    text-align: center;
    color: var(--stalo-text-muted) !important;
    transition: color 0.2s ease;
}

#sidebar .nav > li > a:hover i {
    color: var(--stalo-secondary) !important;
}

#sidebar .nav > li > a span {
    flex: 1;
}

#sidebar .nav > li > a .caret {
    opacity: 0.4;
    transition: transform 0.3s ease;
}

#sidebar .nav > li.expand > a .caret,
#sidebar .nav > li.active > a .caret {
    transform: rotate(90deg);
}

/* Nav Active State */
#sidebar .nav > li.active > a,
#sidebar .nav > li.active > a:focus,
#sidebar .nav > li.active > a:hover {
    background: linear-gradient(135deg, var(--stalo-primary) 0%, var(--stalo-primary) 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(54, 45, 75, 0.3);
}

#sidebar .nav > li.active > a i {
    color: #fff !important;
}

/* Submenu */
#sidebar .nav > li.has-sub > .sub-menu {
    background: var(--stalo-bg-sidebar) !important;
    border-radius: 8px;
    margin: 4px 0 8px 0;
    padding: 6px 0;
    overflow: hidden;
}

#sidebar .sub-menu > li > a {
    color: var(--stalo-text-muted) !important;
    padding: 9px 14px 9px 44px !important;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s ease;
    display: block;
}

#sidebar .sub-menu > li > a:hover {
    color: var(--stalo-primary) !important;
    background: rgba(54, 45, 75, 0.05);
}

#sidebar .sub-menu > li.active > a,
#sidebar .sub-menu > li.active > a:hover,
#sidebar .sub-menu > li.active > a:focus {
    color: var(--stalo-secondary) !important;
    font-weight: 600 !important;
    background: rgba(255, 60, 1, 0.08);
}

/* Minify Button */
#sidebar .sidebar-minify-btn {
    background: var(--stalo-bg-sidebar) !important;
    color: var(--stalo-text-muted) !important;
    border-radius: 8px;
    margin: 10px 10px;
    padding: 10px !important;
    text-align: center;
    transition: all 0.2s ease;
}

#sidebar .sidebar-minify-btn:hover {
    background: var(--stalo-border-color) !important;
    color: var(--stalo-primary) !important;
}

#sidebar .sidebar-minify-btn i {
    font-size: 14px;
}

/* ========== SIDEBAR MINIFICADO ========== */
.page-sidebar-minified #sidebar.sidebar,
.page-sidebar-minified .sidebar-bg {
    width: 60px !important;
}

.page-sidebar-minified #sidebar .nav > li > a {
    padding: 12px !important;
    justify-content: center;
}

.page-sidebar-minified #sidebar .nav > li > a span,
.page-sidebar-minified #sidebar .nav > li > a .caret,
.page-sidebar-minified #sidebar .nav > li.nav-header {
    display: none !important;
}

.page-sidebar-minified #sidebar .nav > li > a i {
    margin: 0;
    width: auto;
    font-size: 18px !important;
}

.page-sidebar-minified #sidebar .nav > li.has-sub:hover > .sub-menu,
.page-sidebar-minified #sidebar .nav > li.has-sub:focus > .sub-menu {
    position: absolute;
    left: 60px;
    top: 0;
    width: 200px;
    background: var(--stalo-bg-light) !important;
    border-radius: 0 12px 12px 0;
    box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--stalo-border-color);
    margin: 0;
    padding: 8px;
}

.page-sidebar-minified #sidebar .sub-menu > li > a {
    padding: 10px 14px !important;
}

.page-sidebar-minified .content {
    margin-left: 65px !important;
}

/* ========== CONTENT AREA ========== */
.content {
    margin-left: calc(var(--stalo-sidebar-width) + 5px) !important;
    padding: 24px !important;
    padding-top: calc(var(--stalo-header-height) + 24px) !important;
    background: #f5f7fa;
    min-height: calc(100vh - var(--stalo-header-height));
    overflow-x: auto;
}

/* ========== KANBAN FIX - Scroll Lateral ========== */
#myKanban {
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

#myKanban .kanban-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: visible !important;
    min-width: max-content !important;
}

/* Garante que o container-fluid não bloqueie o scroll */
.content > .container-fluid {
    overflow-x: visible;
}

/* ========== RESPONSIVO - MOBILE ========== */
@media (max-width: 991px) {
    :root {
        --stalo-sidebar-width: 280px;
    }
    
    /* Header Mobile */
    #header.header {
        height: var(--stalo-header-height);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1040;
    }
    
    #header .navbar-header {
        width: 100%;
        padding: 0 16px;
        justify-content: space-between;
    }
    
    #header .navbar-brand {
        order: 1;
        flex: 1;
    }
    
    #header .navbar-toggle {
        order: 2;
        margin-left: 0;
        position: relative;
        top: auto;
        right: auto;
    }
    
    #header .navbar-nav.navbar-right {
        display: none !important;
    }
    
    /* Sidebar Mobile */
    #sidebar.sidebar {
        position: fixed;
        top: var(--stalo-header-height);
        width: var(--stalo-sidebar-width) !important;
        height: calc(100vh - var(--stalo-header-height));
        z-index: 1035;
        padding-top: 10px !important;
        background: var(--stalo-bg-light) !important;
        /* Usar transform para esconder - mais performático */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        visibility: hidden;
    }
    
    /* Sidebar aberto */
    .page-sidebar-toggled #sidebar.sidebar,
    #page-container.page-sidebar-toggled #sidebar.sidebar {
        transform: translateX(0);
        visibility: visible;
    }
    
    #sidebar [data-scrollbar="true"] {
        height: calc(100vh - var(--stalo-header-height)) !important;
        padding-top: 8px;
    }
    
    .sidebar-bg {
        display: none !important;
    }
    
    /* Overlay quando sidebar está aberto */
    .page-sidebar-toggled #content::before,
    #page-container.page-sidebar-toggled #content::before {
        content: '';
        position: fixed;
        top: var(--stalo-header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1030;
        opacity: 1;
    }
    
    /* Content Mobile */
    .content {
        margin-left: 0 !important;
        padding: 16px !important;
        padding-top: calc(var(--stalo-header-height) + 16px) !important;
        min-height: calc(100vh - var(--stalo-header-height));
    }
    
    /* ========== PERFIL DO USUÁRIO NO SIDEBAR MOBILE ========== */
    
    /* Container do perfil */
    #sidebar .nav > li.nav-profile {    
        background: #FFF;
        border-radius: 0;
    }
    
    #sidebar .nav > li.nav-profile a {
        color: #fff !important;
        padding: 0 !important;
        background: transparent !important;
        display: flex;
        align-items: center;
        gap: 14px;
    }
    
    #sidebar .nav > li.nav-profile a:hover {
        background: transparent !important;
    }
    
    #sidebar .nav > li.nav-profile .info {
        display: flex;
        flex-direction: column;
        gap: 2px;
        flex: 1;
    }
    
    #sidebar .nav > li.nav-profile .info i {
        font-size: 42px !important;
        color: rgba(255, 255, 255, 0.9) !important;
        margin: 0 !important;
        width: 42px !important;
        text-align: center;
    }
    
    #sidebar .nav > li.nav-profile .info b {
        font-size: 15px;
        font-weight: 600;
        display: block;
    }
    
    #sidebar .nav > li.nav-profile .info small {
        color: #333;
        font-size: 12px;
        font-weight: 400;
    }
    
    #sidebar .nav > li.nav-profile .cover {
        display: none !important;
    }
    
    #sidebar .nav > li.nav-profile .caret {
        display: none !important;
    }
    
    /* ========== MENU DO PERFIL (Editar, Sair) NO MOBILE ========== */
    
    #sidebar .nav > li.nav-profile + li {
        display: block !important;
        margin: 0 0 16px;
        padding: 0;
    }
    
    /* Override para ul.nav.nav-profile */
    #sidebar ul.nav.nav-profile,
    .sidebar ul.nav.nav-profile,
    .sidebar .nav.nav-profile,
    #sidebar .nav.nav-profile,
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile {
        display: flex !important;
        gap: 8px;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li,
    #sidebar ul.nav.nav-profile > li,
    .sidebar ul.nav.nav-profile > li {
        flex: 1;
        margin: 0 !important;
        display: block !important;
        -webkit-transform: none;
        transform: none;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li > a,
    #sidebar ul.nav.nav-profile > li > a,
    .sidebar ul.nav.nav-profile > li > a {
        color: var(--stalo-text-dark) !important;
        padding: 12px 16px !important;
        border-radius: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        background: var(--stalo-bg-sidebar) !important;
        border: 1px solid var(--stalo-border-color) !important;
        transition: all 0.2s ease !important;
        text-align: center;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li > a:hover,
    #sidebar ul.nav.nav-profile > li > a:hover,
    .sidebar ul.nav.nav-profile > li > a:hover {
        background: var(--stalo-primary) !important;
        color: #fff !important;
        border-color: var(--stalo-primary) !important;
    }
    
    /* Botão Sair - Destaque especial */
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li:last-child > a,
    #sidebar ul.nav.nav-profile > li:last-child > a,
    .sidebar ul.nav.nav-profile > li:last-child > a {
        background: rgba(220, 53, 69, 0.1) !important;
        color: #dc3545 !important;
        border-color: rgba(220, 53, 69, 0.2) !important;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li:last-child > a:hover,
    #sidebar ul.nav.nav-profile > li:last-child > a:hover,
    .sidebar ul.nav.nav-profile > li:last-child > a:hover {
        background: #dc3545 !important;
        color: #fff !important;
        border-color: #dc3545 !important;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li > a i,
    #sidebar ul.nav.nav-profile > li > a i,
    .sidebar ul.nav.nav-profile > li > a i {
        width: auto !important;
        font-size: 14px !important;
        color: inherit !important;
    }
    
    /* Separador visual */
    #sidebar .nav > li.nav-profile + li::after {
        content: '';
        display: block;
        height: 1px;
        background: var(--stalo-border-color);
        margin: 16px 0 8px;
    }
}

@media (max-width: 576px) {
    :root {
        --stalo-sidebar-width: 100%;
        --stalo-header-height: 56px;
    }
    
    #header .navbar-brand img {
        height: 28px;
    }
    
    #header .navbar-toggle {
        padding: 8px 10px;
        height: 35px;
        width: 50px;
    }
    
    .content {
        padding: 12px !important;
        padding-top: calc(var(--stalo-header-height) + 12px) !important;
    }
    
    /* Perfil mobile em tela pequena */
    #sidebar .nav > li.nav-profile {
        margin: 8px;
        padding: 16px;
        border-radius: 12px;
    }
    
    #sidebar .nav > li.nav-profile + li {
        margin: 0 0 12px;
    }
    
    #sidebar .nav > li.nav-profile + li > ul.nav.nav-profile > li > a,
    #sidebar ul.nav.nav-profile > li > a {
        padding: 10px 12px !important;
        font-size: 12px !important;
    }
}

/* ========== LAYOUT GERAL ========== */
body {
    font-weight: 500;
}

.page-stalo {
    background: #f8f9fa;
    min-height: 100vh;
    padding: 0;
}

.page-stalo .panel {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: none;
}

.page-stalo .panel-body {
    padding: 24px;
}

/* ========== HEADER DA PÁGINA ========== */
.page-header-stalo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.page-header-stalo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header-stalo h1 i {
    color: #ff3c01;
}

/* ========== BOTÕES PRINCIPAIS ========== */
.btn-stalo-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    color: #362d4b;
    border: 2px solid #362d4b;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-stalo-primary:hover {
    background: #362d4b;
    color: #fff;
    text-decoration: none;
}

/* ========== FILTROS POR STATUS - BOTÕES ========== */
.status-filter-container {
    margin-bottom: 24px;
}

.status-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-status-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    background: #fff;
    color: #495057;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-status-filter:hover {
    border-color: #362d4b;
    color: #362d4b;
}

.btn-status-filter.active {
    border-color: #362d4b;
    background: #362d4b;
    color: #fff;
}

.btn-status-filter.active .status-count {
    background: rgba(255,255,255,0.3);
    color: #fff;
}

.status-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #e9ecef;
    color: #495057;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Cores específicas para contagens */
.status-count-success { background: #d4edda; color: #155724; }
.status-count-warning { background: #fff3cd; color: #856404; }
.status-count-info { background: #cce5ff; color: #004085; }
.status-count-danger { background: #f8d7da; color: #721c24; }
.status-count-primary { background: #cce5ff; color: #004085; }
.status-count-purple { background: #e2d9f3; color: #5a3d7a; }
.status-count-secondary { background: #e9ecef; color: #495057; }

/* ========== CONTAINER DE FILTROS ========== */
.filtros-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    align-items: end;
}

.filtro-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.filtro-item input,
.filtro-item select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #fff;
}

.filtro-item input:focus,
.filtro-item select:focus {
    border-color: #362d4b;
    box-shadow: 0 0 0 3px rgba(54,45,75,0.1);
    outline: none;
}

.btn-limpar-filtro {
    background: #fff;
    border: 2px solid #dee2e6;
    color: #6c757d;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-limpar-filtro:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

/* ========== TABELA MODERNA ========== */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Corrige overflow causado pelas rows do DataTables */
.table-container .dataTables_wrapper {
    overflow: hidden;
}

.table-container .dataTables_wrapper > .row {
    margin-left: 0;
    margin-right: 0;
}

.table-stalo,
#data-table-responsive {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    margin-bottom: 0 !important;
    color: #333;
}

.table-stalo thead th,
#data-table-responsive thead th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 12px;
    border: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.table-stalo thead th:first-child,
#data-table-responsive thead th:first-child {
    border-radius: 10px 0 0 0;
}

.table-stalo thead th:last-child,
#data-table-responsive thead th:last-child {
    border-radius: 0 10px 0 0;
}

.table-stalo tbody td,
#data-table-responsive tbody td {
    padding: 14px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
    background: #fff;
}

.table-stalo tbody tr:hover td,
#data-table-responsive tbody tr:hover td {
    background: #f8f9fa;
}

.table-stalo tbody tr:last-child td:first-child,
#data-table-responsive tbody tr:last-child td:first-child {
    border-radius: 0 0 0 10px;
}

.table-stalo tbody tr:last-child td:last-child,
#data-table-responsive tbody tr:last-child td:last-child {
    border-radius: 0 0 10px 0;
}

/* ========== BADGES DE STATUS ========== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Status Gerais */
.badge-pago {
    background: #d4edda;
    color: #155724;
    border: 1px solid #b8dacd;
}

.badge-pago-mais {
    background: #e2d9f3;
    color: #5a3d7a;
    border: 1px solid #c9b8dc;
}

.badge-parcial {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #abdde5;
}

.badge-atrasado {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.badge-realizar {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.badge-previsto {
    background: #e7f1ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.badge-pendente {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.badge-default {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

/* Status de Obras */
.badge-planejamento {
    background: #e7f1ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.badge-em_andamento {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.badge-concluida {
    background: #d4edda;
    color: #155724;
    border: 1px solid #b8dacd;
}

.badge-cancelada {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

/* Status de Compras */
.badge-compra-realizada,
.badge-compra-finalizada {
    background: #d4edda;
    color: #155724;
    border: 1px solid #b8dacd;
}

.badge-entregue {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* ========== BADGES DE TIPO ========== */
.badge-tipo {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-material {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-servico {
    background: #fce4ec;
    color: #c2185b;
}

.badge-locacao {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-outros {
    background: #f3e5f5;
    color: #7b1fa2;
}

/* ========== BOTÕES DE AÇÃO ========== */
.acoes-cell {
    white-space: nowrap;
    text-align: center;
}

.acoes-cell > div,
.acoes-cell > .d-flex {
    display: inline-flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: nowrap;
}

.btn-acao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-acao:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-visualizar {
    color: #362d4b;
    border-color: #362d4b;
}

.btn-visualizar:hover {
    background: #362d4b;
    color: #fff;
}

.btn-editar {
    color: #ff3c01;
    border-color: #ff3c01;
}

.btn-editar:hover {
    background: #ff3c01;
    color: #fff;
}

.btn-excluir {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-excluir:hover {
    background: #dc3545;
    color: #fff;
}

.btn-aprovar {
    color: #28a745;
    border-color: #28a745;
}

.btn-aprovar:hover {
    background: #28a745;
    color: #fff;
}

.btn-success-outline {
    color: #28a745;
    border-color: #28a745;
}

.btn-success-outline:hover {
    background: #28a745;
    color: #fff;
}

/* Grupo de botões de ação */
.btn-group-stalo {
    display: inline-flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: nowrap;
}

/* Botões de ação pequenos */
.btn-acao-view,
.btn-acao-edit,
.btn-acao-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1.5px solid;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-acao-view {
    color: #362d4b;
    border-color: #362d4b;
}

.btn-acao-view:hover {
    background: #362d4b;
    color: #fff;
    text-decoration: none;
}

.btn-acao-edit {
    color: #362d4b;
    border-color: #362d4b;
}

.btn-acao-edit:hover {
    background: #362d4b;
    color: #fff;
    text-decoration: none;
}

.btn-acao-delete {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-acao-delete:hover {
    background: #dc3545;
    color: #fff;
    text-decoration: none;
}

/* Badge aprovado */
.badge-aprovado {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    background: #e3fcef;
    color: #006644;
    border: 1px solid #79f2c0;
}

.badge-aprovado i {
    font-size: 0.75rem;
}

/* ========== CARDS DE LISTAGEM ========== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.card-item {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    padding: 20px;
    transition: all 0.2s ease;
}

.card-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.card-header-stalo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: #362d4b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.card-title-area {
    flex: 1;
    margin-left: 14px;
}

.card-title {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 1.2rem;
    margin: 0 0 5px 0;
    line-height: 1.3;
    border-bottom: none;
    padding-bottom: 0;
}

.card-subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0;
}

.card-body-stalo {
    margin-bottom: 16px;
}

.card-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.card-info-grid-3cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.card-codigo {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.card-info-item {
    display: flex;
    flex-direction: column;
}

.card-info-label {
    font-size: 0.7rem;
    color: #adb5bd;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 2px;
}

.card-info-value {
    font-size: 0.9rem;
    color: #1a1a2e;
    font-weight: 500;
}

.card-info-value.valor-previsto { color: #6c757d; }
.card-info-value.valor-aprovado { color: #0d6efd; }
.card-info-value.valor-realizado { color: #198754; }

.card-footer-stalo {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #f1f3f4;
    flex-wrap: wrap;
}

/* ========== VALORES ========== */
.valor-cell {
    text-align: right;
}

.valor-principal {
    font-weight: 700;
    font-size: 0.9rem;
}

.valor-destaque {
    font-weight: 700;
    color: #1a1a2e;
}

.valor-total {
    color: #6c757d;
    font-size: 0.85rem;
}

.valor-previsto { color: #6c757d; }
.valor-aprovado { color: #0d6efd; }
.valor-realizado { color: #198754; }

/* ========== INFORMAÇÕES EXTRAS ========== */
.parcela-info {
    font-size: 0.75rem;
    color: #6c757d;
    font-weight: 500;
}

.pagamentos-section {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #dee2e6;
}

.pagamentos-label {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 600;
}

.pagamento-item-linha {
    font-size: 0.8rem;
    color: #28a745;
    font-weight: 500;
}

.pagamento-item-linha .pag-meio {
    font-size: 0.7rem;
    color: #adb5bd;
    font-weight: 400;
}

/* Data Devolução Locação */
.data-devolucao-info {
    margin-top: 6px;
    font-size: 0.6rem;
    color: #6c757d;
    line-height: 1.3;
}

.data-devolucao-info span {
    display: block;
}

.data-devolucao-info strong {
    color: #2e7d32;
    font-size: 0.7rem;
}

/* Boleto link */
.boleto-link {
    display: block;
    font-size: 0.7rem;
    color: #1a1a2e;
    text-decoration: none;
    margin-top: 2px;
}

.boleto-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.boleto-link i {
    font-size: 0.65rem;
    margin-left: 3px;
}

.forma-pagamento-info {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 2px;
}

/* ========== ALERTAS ========== */
.alert {
    border-radius: 10px;
    border: none;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ========== ESTADO VAZIO ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #495057;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 768px) {
    .page-header-stalo {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .status-filter-buttons {
        flex-wrap: wrap;
    }
    
    .btn-status-filter {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .filtros-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== DATATABLES CUSTOMIZAÇÃO ========== */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #362d4b;
    box-shadow: 0 0 0 3px rgba(54,45,75,0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 6px 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #362d4b !important;
    border-color: #362d4b !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_info {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Botão Exportar Excel */
.btn-export-excel {
    background: #28a745;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
}

/* Remove scroll horizontal */
.dataTables_scrollBody {
    overflow-x: hidden !important;
}

/* Remove text-muted das tabelas - usar cor padrão */
.dataTables_wrapper .text-muted,
table .text-muted {
    color: inherit !important;
}

/* ========== LOADING ========== */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #362d4b;
}
/* ========== FORMULÁRIOS PADRONIZADOS ========== */
.form-stalo {
    width: 100%;
}

.form-section {
    background: #fff;
    margin-bottom: 24px;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #362d4b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.form-section-title i {
    color: #ff3c01;
    font-size: 1rem;
}

.form-row-stalo {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 0;
}

.form-group-stalo {
    margin-bottom: 20px;
}

.form-group-stalo.stalo-col-1 { grid-column: span 1; }
.form-group-stalo.stalo-col-2 { grid-column: span 2; }
.form-group-stalo.stalo-col-3 { grid-column: span 3; }
.form-group-stalo.stalo-col-4 { grid-column: span 4; }
.form-group-stalo.stalo-col-5 { grid-column: span 5; }
.form-group-stalo.stalo-col-6 { grid-column: span 6; }
.form-group-stalo.stalo-col-7 { grid-column: span 7; }
.form-group-stalo.stalo-col-8 { grid-column: span 8; }
.form-group-stalo.stalo-col-9 { grid-column: span 9; }
.form-group-stalo.stalo-col-10 { grid-column: span 10; }
.form-group-stalo.stalo-col-11 { grid-column: span 11; }
.form-group-stalo.stalo-col-12 { grid-column: span 12; }

.form-label-stalo {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.form-label-stalo.required::after {
    content: ' *';
    color: #ff3c01;
}

.form-control-stalo {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #1a1a2e;
    background: #fff;
    transition: all 0.2s ease;
}

.form-control-stalo:focus {
    border-color: #362d4b;
    box-shadow: 0 0 0 4px rgba(54,45,75,0.1);
    outline: none;
}

.form-control-stalo::placeholder {
    color: #adb5bd;
}

.form-control-stalo:disabled,
.form-control-stalo[readonly] {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

select.form-control-stalo {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23495057' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea.form-control-stalo {
    min-height: 120px;
    resize: vertical;
}

/* Input Maiúsculas */
.input-uppercase {
    text-transform: uppercase;
}

.input-uppercase::placeholder {
    text-transform: none;
}

/* Select2 Padronizado */
.select2-stalo {
    position: relative;
}

.select2-stalo .select2-container {
    width: 100% !important;
}

.select2-stalo .select2-container .select2-selection--multiple {
    min-height: 48px !important;
    padding: 6px 12px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 10px !important;
    background: #fff !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.select2-stalo .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.select2-stalo .select2-container--focus .select2-selection--multiple {
    border-color: #362d4b !important;
    box-shadow: 0 0 0 4px rgba(54,45,75,0.1) !important;
}

.select2-stalo .select2-selection__choice {
    background: #362d4b !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    margin: 0 !important;
    font-size: 0.85rem;
}

.select2-stalo .select2-selection__choice__remove {
    color: #fff !important;
    margin-right: 6px !important;
    border: none !important;
}

.select2-stalo .select2-selection__choice__remove:hover {
    color: #ff3c01 !important;
    background: transparent !important;
}

.select2-stalo .select2-search--inline .select2-search__field {
    margin: 0 !important;
    padding: 0 !important;
    height: 32px !important;
}

.select2-stalo .select2-search--inline .select2-search__field::placeholder {
    color: #adb5bd;
}

/* Input com loader (CEP) */
.input-with-loader {
    position: relative;
}

.input-with-loader .form-control-stalo {
    padding-right: 40px;
}

.cep-loader {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #362d4b;
    display: none;
}

/* Paleta de Cores */
.color-palette-stalo {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
}

.color-swatch-stalo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border: 3px solid transparent;
}

.color-swatch-stalo:hover {
    transform: scale(1.1);
}

.color-swatch-stalo input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.color-swatch-stalo.is-selected {
    border-color: #1a1a2e;
    box-shadow: 0 0 0 3px rgba(26,26,46,0.3);
}

.color-swatch-stalo.is-selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Botões do Formulário */
.form-actions-stalo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
    margin-top: 8px;
}

.btn-submit-stalo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #362d4b;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit-stalo:hover {
    background: #2a2339;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54,45,75,0.3);
}

.btn-submit-stalo i {
    font-size: 0.9rem;
}

.btn-cancel-stalo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #fff;
    color: #6c757d;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-cancel-stalo:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
    text-decoration: none;
}

.btn-clear-color-stalo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.btn-clear-color-stalo:hover {
    background: #fff;
    border-color: #ff3c01;
    color: #ff3c01;
}

/* Alertas Padronizados */
.alert-stalo {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-stalo i {
    font-size: 1.1rem;
    margin-top: 2px;
}

.alert-stalo-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-stalo-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-stalo-danger ul {
    margin: 0;
    padding-left: 20px;
}

.alert-stalo-danger li {
    margin-bottom: 4px;
}

/* Responsivo - Formulários */
@media (max-width: 992px) {
    .form-group-stalo.stalo-col-3,
    .form-group-stalo.stalo-col-4 {
        grid-column: span 6;
    }
    
    .form-group-stalo.stalo-col-6 {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .form-row-stalo {
        grid-template-columns: 1fr;
    }
    
    .form-group-stalo.stalo-col-1,
    .form-group-stalo.stalo-col-2,
    .form-group-stalo.stalo-col-3,
    .form-group-stalo.stalo-col-4,
    .form-group-stalo.stalo-col-5,
    .form-group-stalo.stalo-col-6,
    .form-group-stalo.stalo-col-7,
    .form-group-stalo.stalo-col-8,
    .form-group-stalo.stalo-col-9,
    .form-group-stalo.stalo-col-10,
    .form-group-stalo.stalo-col-11,
    .form-group-stalo.stalo-col-12 {
        grid-column: span 1;
    }
    
    .form-actions-stalo {
        flex-direction: column;
    }
    
    .btn-submit-stalo,
    .btn-cancel-stalo {
        width: 100%;
        justify-content: center;
    }
}