:root {
  --mg-primary-dark: #3C3C3B;
  --mg-secondary-gray: #706F6F;
  --mg-highlight-red: #AE0F0A;
  --mg-background-light: #E3E3E3;

  --mg-text-light: #ffffff;
  --mg-text-dark: #1f2937;
  --mg-border-light: #d1d5db;
}

/* 🌐 COMPATIBILIDADE DE NAVEGADORES */
*, *::before, *::after {
  box-sizing: border-box; /* Garante que padding não quebre o layout em nenhum navegador */
}

html {
  -webkit-text-size-adjust: 100%; /* Evita redimensionamento de texto no iOS */
  -ms-text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased; /* Melhor renderização de fontes no Chrome/Safari */
  -moz-osx-font-smoothing: grayscale; /* Melhor renderização no Firefox/Mac */
  text-rendering: optimizeLegibility;
}

.bg-soft-gray {
    background-color: var(--mg-secondary-gray) !important;
    color: white !important;
}

.bg-soft-red {
    background-color: #c0392b !important;
    color: white !important;
}

.btn-soft-red {
    background-color: #c0392b !important;
    border-color: #c0392b !important;
    color: white !important;
    transition: all 0.3s ease;
}

.btn-soft-red:hover {
    background-color: #a93226 !important;
    border-color: #a93226 !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.bg-light-gray {
    background-color: #f8f9fa !important;
    color: var(--mg-primary-dark) !important;
    border-bottom: 1px solid #dee2e6 !important;
}

/* Base */
body {
  background-color: var(--mg-background-light);
  font-family: "Inter", system-ui, sans-serif;
  color: var(--mg-text-dark);
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--mg-primary-dark);
  height: 100vh;
  position: fixed;
  overflow-y: auto;
}

/* Custom Scrollbar for Sidebar (Webkit: Chrome, Edge, Safari) */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--mg-primary-dark);
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--mg-secondary-gray);
  border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--mg-highlight-red);
}

/* Custom Scrollbar for Sidebar (Firefox) */
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--mg-secondary-gray) var(--mg-primary-dark);
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #2e2e2d;
}

.logo {
  height: 50px;
  max-width: 100%;
  margin-right: 50px;
}

.app-title {
  color: var(--mg-text-light);
  font-weight: 600;
  font-size: 1.1rem;
}

/* Menu */
.menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #e5e7eb;
  text-decoration: none;
  transition: background 0.2s ease;
}

.menu li a:hover {
  background: var(--mg-secondary-gray);
  color: #fff;
}

.menu > li.active > a {
  background: var(--mg-highlight-red);
  color: #fff;
  font-weight: 600;
}

.menu-title {
  padding: 16px 20px 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 4px;
}

/* Nested Menu Styles */
.menu .nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #e5e7eb;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.menu .nav-item .nav-link i:first-child {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.menu .nav-item .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Removed broad rule to avoid submenu interference */

/* Submenu container */
.menu .submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--mg-background-light); /* Light grey background for submenu */
}

.menu .submenu li a {
  padding: 10px 20px 10px 42px; /* Further reduced padding (was 58px) */
  font-size: 0.85rem;
  color: var(--mg-secondary-gray); /* Medium grey text */
  transition: all 0.2s ease;
}

.menu .submenu li a:hover {
  color: var(--mg-primary-dark);
  background: rgba(0, 0, 0, 0.05);
}

.menu .submenu li.active a {
  color: var(--mg-primary-dark) !important; /* Force dark grey for selected item */
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
}

/* Chevron indicator */
.menu .has-submenu .nav-link::after {
  content: "\F282"; /* bootstrap-icons chevron-down */
  font-family: "bootstrap-icons";
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.menu .has-submenu .nav-link[aria-expanded="true"]::after {
  transform: rotate(180deg);
  opacity: 1;
}

.menu > li.has-submenu > .nav-link[aria-expanded="true"] {
  background: var(--mg-highlight-red);
  color: #fff;
}

/* Divider inside submenu */
.menu .submenu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 5px 20px;
}

/* Content */
.content {
  margin-left: 250px;
  width: calc(100% - 250px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background: #ffffff;
  padding: 10px 20px;
  border-bottom: 2px solid var(--mg-primary-dark);
  display: flex;
  align-items: center;
}

.topbar .btn {
  border-color: var(--mg-secondary-gray);
}

.topbar .btn:hover {
  background: var(--mg-primary-dark);
  color: #fff;
}

/* Main content */
main {
  flex: 1;
}

/* Cards (para listas, indicadores etc.) */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-header {
  background: var(--mg-primary-dark);
  color: #fff;
  font-weight: 500;
}

/* Alerts Bootstrap Reverted */
.alert {
  border-radius: 8px;
  border-left: 5px solid transparent;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.alert-success {
  border-left-color: #28a745;
}

.alert-danger {
  border-left-color: #dc3545;
}

.alert-warning {
  border-left-color: #ffc107;
}

.alert-info {
  border-left-color: #17a2b8;
}

/* Footer */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--mg-border-light);
  padding: 12px;
  font-size: 0.8rem;
  color: var(--mg-secondary-gray);
}

/*Titulo, botoes, cards */
.page-header {
  margin-bottom: 1rem;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--mg-secondary-gray);
}

.card-header {
  background: var(--mg-primary-dark);
  color: #fff;
  font-size: 0.9rem;
}

.btn-danger {
  background: var(--mg-highlight-red);
  border-color: var(--mg-highlight-red);
}

.btn-danger:hover {
  background: #8f0c08;
  border-color: #8f0c08;
}

/* Links ordenáveis */
.sortable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.sortable:hover {
  text-decoration: underline;
}

.sortable.active {
  color: #ffffff;
  font-weight: 600;
}

/* Tabela */
.table thead th {
  font-size: 0.8rem;
  word-wrap: break-word;
}

.table tbody td {
  font-size: 0.85rem;
}

.table-order-link {
  color: #3C3C3B;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table-order-link:hover {
  color: #AE0F0A;
  text-decoration: underline;
}

.table-order-link.active {
  color: #AE0F0A;
  font-weight: 600;
}

.table-order-link svg,
.table-order-link i {
  font-size: 0.75rem;
  opacity: 0.9;
}

/* Paginação */
.page-link {
  color: var(--mg-primary-dark);
}

.page-item.active .page-link,
.page-link:hover {
  background: var(--mg-highlight-red);
  border-color: var(--mg-highlight-red);
  color: #fff;
}

/* Indicadores */
.indicator-card {
  border-radius: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.indicator-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
}

.indicator-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.bg-black {
  background-color: #000000 !important;
}

/* Títulos e valores */
.indicator-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-secondary-gray);
  margin-bottom: 2px;
}

.indicator-value {
  font-weight: 700;
  margin: 0;
  color: var(--mg-primary-dark);
}

/* Cores alinhadas ao MG */
.bg-dark {
  background: var(--mg-primary-dark) !important;
}

.bg-danger {
  background: var(--mg-highlight-red) !important;
}

/* Link do card */
.indicator-link {
  text-decoration: none;
  color: inherit;
}

.indicator-link:hover {
  color: inherit;
}

/* Espaçamento entre ícone e texto */
.indicator-text {
  margin-left: 18px;
  /* ← aqui resolve o texto "rente" */
}

/* Form solicitacao */
.item-solicitacao {
  border-left: 5px solid var(--mg-secondary-gray);
}

.item-solicitacao:hover {
  border-left-color: var(--mg-primary-dark);
}

.badge-action {
  background-color: var(--mg-highlight-red);
  color: #fff;
}

.campos-dinamicos {
  margin-top: 1rem;
}

/* MODO LEITURA */
.item-solicitacao select:disabled,
.item-solicitacao input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
}

/*FORMULARIOS */
.zebra {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.zebra-dark {
  background-color: #e9ecef;
}

.zebra-light {
  background-color: #ffffff;
}

.zebra .form-group,
.zebra .form-control,
.zebra label {
  background-color: transparent;
}

/* Títulos de seção do formulário */
.section-header {
  background: linear-gradient(135deg, var(--mg-primary-dark) 0%, var(--mg-secondary-gray) 100%);
  color: #fff;
  padding: 15px 15px;
  border-radius: 8px 8px 0 0;
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header i {
  font-size: 1.1rem;
  opacity: 0.9;
}

.section-header small {
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.8rem;
  margin-left: auto;
}

/* Bloco de conteúdo conectado ao título */
.section-block {
  padding: 20px;
}

/* Container de cada seção - fundo branco com sombra */
.section-container {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow: hidden;
}

/* Título geral do card de dados */
.section-main-title {
  background: var(--mg-secondary-gray);
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-main-title i {
  font-size: 1.2rem;
}

.section-main-title small {
  font-weight: 400;
  opacity: 0.85;
  font-size: 0.85rem;
}

/* Itens da solicitação - título */
.section-items-title {
  background: var(--mg-primary-dark);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}