:root {
  --font-primary: 'Inter', system-ui, -apple-system, sans-serif;
  --verde-primario: #2E7D32;
  --verde-secundario: #66BB6A;
  --azul-tec: #1976D2;
  --amarelo-prod: #FBC02D;
  --cinza-escuro: #37474F;
  
  /* Mapeamento para variáveis funcionais */
  --primary-color: var(--verde-primario);
  --secondary-color: var(--cinza-escuro);
  --bg-light: #f8f9fa;
  --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --card-radius: 12px;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

body {
  font-family: var(--font-primary);
  background-color: #f4f6f8;
  color: #333;
  margin-bottom: 60px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Modern Card Style */
.card {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Navbar Modernization */
.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  background-color: #fff !important;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Buttons */
.btn {
  border-radius: 8px;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(46, 125, 50, 0.2);
}

.btn-primary:hover {
  background-color: #1b5e20;
  border-color: #1b5e20;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(46, 125, 50, 0.25);
}

.text-primary {
  color: var(--primary-color) !important;
}

.bg-primary {
  background-color: var(--primary-color) !important;
}

.border-primary {
  border-color: var(--primary-color) !important;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* --- Sidebar Layout --- */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

#sidebar-wrapper {
    min-width: 260px;
    max-width: 260px;
    background-color: #fff;
    border-right: 1px solid #e9ecef;
    transition: all 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

/* Estado collapsed para desktop */
@media (min-width: 769px) {
    #sidebar-wrapper.collapsed {
        min-width: 70px;
        max-width: 70px;
    }
    
    #sidebar-wrapper.collapsed .sidebar-heading {
        padding: 1.5rem 0.5rem;
        justify-content: center;
    }
    
    #sidebar-wrapper.collapsed .sidebar-heading span {
        display: none;
    }
    
    #sidebar-wrapper.collapsed .logo-text,
    #sidebar-wrapper.collapsed .list-group-item span,
    #sidebar-wrapper.collapsed .user-info span,
    #sidebar-wrapper.collapsed .user-info small {
        display: none;
    }
    
    #sidebar-wrapper.collapsed .list-group-item {
        justify-content: center;
        padding: 0.75rem 0.5rem;
    }
    
    #sidebar-wrapper.collapsed .list-group-item i {
        margin-right: 0;
        font-size: 1.25rem;
    }
    
    #sidebar-wrapper.collapsed .user-info {
        align-items: center;
        padding: 1rem 0.5rem;
    }
    
    #sidebar-wrapper.collapsed .user-photo {
        margin-right: 0;
        margin-bottom: 0;
    }
    
    #sidebar-wrapper.collapsed .sidebar-submenu {
        display: none;
    }
    
    #sidebar-wrapper.collapsed .dropdown-toggle::after {
        display: none;
    }
    
    #sidebar-wrapper.collapsed .p-3.border-top {
        width: 70px !important;
    }
    
    #sidebar-wrapper.collapsed .p-3.border-top > a > div > div:nth-child(2),
    #sidebar-wrapper.collapsed .p-3.border-top form button span {
        display: none;
    }
    
    #sidebar-wrapper.collapsed .p-3.border-top form button {
        padding: 0.5rem;
    }
}

#sidebar-wrapper .sidebar-heading {
    padding: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#sidebar-wrapper .list-group {
    width: 100%;
    padding: 1rem 0;
}

#sidebar-wrapper .list-group-item {
    border: none;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: #495057;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

#sidebar-wrapper .list-group-item i {
    width: 24px;
    margin-right: 0.5rem;
    text-align: center;
    color: #adb5bd;
    transition: color 0.2s;
}

#sidebar-wrapper .list-group-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

#sidebar-wrapper .list-group-item:hover i {
    color: var(--primary-color);
}

#sidebar-wrapper .list-group-item.active {
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

#sidebar-wrapper .list-group-item.active i {
    color: var(--primary-color);
}

/* Submenu styles */
.sidebar-submenu {
    font-size: 0.9rem;
    padding-left: 1rem;
}

.sidebar-submenu .list-group-item {
    padding: 0.5rem 1.5rem 0.5rem 2.5rem;
}

#page-content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-left: 260px;
    transition: margin-left 0.3s ease-in-out;
}

/* Quando sidebar está collapsed, ajusta margem */
#page-content-wrapper.sidebar-collapsed {
    margin-left: 70px;
}

/* Toggled State */
#wrapper.toggled #sidebar-wrapper {
    margin-left: -260px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #sidebar-wrapper {
        margin-left: -260px;
        position: fixed;
        height: 100%;
        z-index: 1000;
        box-shadow: 0 0 15px rgba(0,0,0,0.1);
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
    
    #page-content-wrapper {
        min-width: 100vw;
        margin-left: 0 !important;
    }
}

/* Overlay for mobile when sidebar is open */
#sidebar-overlay {
    display: none;
    position: fixed;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

#wrapper.toggled #sidebar-overlay {
    display: block;
}

@media (min-width: 769px) {
    #sidebar-overlay {
        display: none !important;
    }
}

/* Navbar in Content */
.navbar-content {
    padding: 0.75rem 1.5rem;
    min-height: 100px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Main Content Area */
.main-content {
    padding: 2rem;
    flex: 1;
    background-color: #f4f6f8;
}

/* Footer */
.footer-content {
    padding: 1rem 2rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* --- Mobile Responsive Table (Cards) --- */
@media (max-width: 767.98px) {
  .table-mobile-cards {
    border: 0;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody tr {
    display: block;
    background: #fff;
    margin-bottom: 1rem;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 1rem;
    position: relative;
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid #eee;
    text-align: right;
  }

  .table-mobile-cards tbody td:last-child {
    border-bottom: none;
    justify-content: center;
    padding-top: 1rem;
    margin-top: 0.5rem;
    gap: 0.5rem;
  }

  /* Label for the data */
  .table-mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6c757d;
    text-align: left;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  /* Special styling for Actions column */
  .table-mobile-cards tbody td.actions-cell {
    display: flex;
    width: 100%;
    justify-content: stretch;
    gap: 8px;
  }
  
  .table-mobile-cards tbody td.actions-cell .btn {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}