* {
  box-sizing: border-box;
}

:root {
  --efex-bg: #f4f7fb;
  --efex-sidebar: #0f172a;
  --efex-sidebar-2: #111827;
  --efex-card: #ffffff;
  --efex-text: #111827;
  --efex-muted: #6b7280;
  --efex-border: #e5e7eb;
  --efex-primary: #2563eb;
  --efex-primary-dark: #1d4ed8;
  --efex-danger: #dc2626;
  --efex-radius: 16px;
  --efex-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--efex-bg);
  color: var(--efex-text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}

/* Layout principal */
.container-scroller {
  min-height: 100vh;
  background: var(--efex-bg);
}

.page-body-wrapper,
.app-body-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  padding: 0 !important;
}

/* Sidebar */
.sidebar,
.app-sidebar {
  width: 270px;
  min-width: 270px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--efex-sidebar), var(--efex-sidebar-2));
  color: #ffffff;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 8px 0 26px rgba(15, 23, 42, 0.16);
}

/* Nome Efex Apps */
.app-sidebar-brand {
  padding: 24px 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.app-sidebar-logo {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.app-sidebar-logo img {
  max-width: 30px;
  max-height: 30px;
  object-fit: contain;
  display: block;
}

.app-sidebar-title strong {
  display: block;
  color: #ffffff;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
}

.app-sidebar-title span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  margin-top: 4px;
}

/* Usuário */
.app-sidebar-user {
  margin: 16px 12px 10px;
  padding: 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-user-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--efex-primary), var(--efex-primary-dark));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.app-user-data {
  min-width: 0;
  flex: 1;
}

.app-user-data strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-user-data span {
  display: block;
  color: #94a3b8;
  font-size: 11px;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu lateral */
.sidebar .nav,
.app-sidebar-menu {
  list-style: none;
  padding: 10px 10px 24px;
  margin: 0;
}

.sidebar .nav .nav-item {
  margin-bottom: 6px;
  list-style: none;
}

.sidebar .nav .nav-link {
  min-height: 46px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-radius: 13px;
  color: #cbd5e1;
  text-decoration: none;
  transition: 0.18s ease;
}

.sidebar .nav .nav-link i {
  width: 24px;
  min-width: 24px;
  height: 24px;
  line-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  font-size: 21px;
  margin: 0;
  padding: 0;
}

.sidebar .nav .nav-link .menu-title {
  display: inline-block;
  line-height: 1.2;
  font-size: 14px;
  font-weight: 600;
  color: inherit;
}

.sidebar .nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar .nav .nav-link:hover i {
  color: #ffffff;
}

.sidebar .nav .nav-item.active .nav-link {
  background: linear-gradient(135deg, var(--efex-primary), var(--efex-primary-dark));
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.sidebar .nav .nav-item.active .nav-link i {
  color: #ffffff;
}

/* Sair */
.sidebar .nav .app-sidebar-logout {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar .nav .app-sidebar-logout .nav-link {
  background: rgba(220, 38, 38, 0.13);
  color: #fecaca;
}

.sidebar .nav .app-sidebar-logout .nav-link i {
  color: #fecaca;
}

.sidebar .nav .app-sidebar-logout .nav-link:hover {
  background: var(--efex-danger);
  color: #ffffff;
}

.sidebar .nav .app-sidebar-logout .nav-link:hover i {
  color: #ffffff;
}

/* Conteúdo */
.main-panel,
.app-main-panel {
  width: calc(100% - 270px);
  min-height: 100vh;
  margin-left: 270px;
  background: var(--efex-bg);
  display: flex;
  flex-direction: column;
}

.content-wrapper,
.app-content-wrapper {
  flex: 1;
  padding: 28px;
  background: var(--efex-bg);
}

/* Grid básico para substituir dependência visual do template antigo */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -12px;
  margin-right: -12px;
}

[class*="col-"] {
  padding-left: 12px;
  padding-right: 12px;
  width: 100%;
}

.col-12,
.col-lg-12 {
  flex: 0 0 100%;
  max-width: 100%;
}

.col-xl-9 {
  flex: 0 0 75%;
  max-width: 75%;
}

.col-xl-10 {
  flex: 0 0 83.333333%;
  max-width: 83.333333%;
}

/* Cards */
.card,
.form-card,
.table-responsive {
  background: var(--efex-card);
  border: 1px solid var(--efex-border);
  border-radius: var(--efex-radius);
  box-shadow: var(--efex-shadow);
  overflow: hidden;
}

.card-body {
  padding: 22px;
}

.card-title {
  margin: 0;
  color: var(--efex-text);
  font-size: 18px;
  font-weight: 800;
}

.bg-light {
  background: #f8fafc !important;
}

.border-bottom {
  border-bottom: 1px solid var(--efex-border) !important;
}

.p-4 {
  padding: 20px !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mt-4 {
  margin-top: 24px !important;
}

.grid-margin {
  margin-bottom: 24px;
}

.stretch-card {
  display: flex;
  align-items: stretch;
}

.stretch-card > .card {
  width: 100%;
}

/* Títulos */
h1,
h2,
h3,
h4,
h5 {
  color: var(--efex-text);
  font-weight: 800;
}

.page-header {
  margin: 0 0 18px;
}

.info {
  color: var(--efex-text);
}

/* Formulários */
label {
  font-weight: 600;
  color: #374151;
}

.form-control,
input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--efex-text);
  background: #ffffff;
  outline: none;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--efex-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.d-block {
  display: block;
}

.text-white {
  color: #ffffff !important;
}

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

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

/* Botões */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: 0.18s ease;
}

.btn-primary {
  background: var(--efex-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--efex-primary-dark);
}

.btn-danger {
  background: var(--efex-danger);
  color: #ffffff;
}

/* Grupo de botão */
.btn-group {
  display: inline-flex;
  align-items: center;
}

.toolbar-item {
  max-width: 100%;
}

/* Tabelas */
.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--efex-text);
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--efex-border);
  vertical-align: middle;
}

.table thead th {
  background: #f8fafc;
  font-weight: 800;
}

/* Alertas básicos */
.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-weight: 600;
}

.alert-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.alert-danger,
.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Footer */
.footer,
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--efex-border);
  padding: 18px 28px;
  color: var(--efex-muted);
}

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

.text-center {
  text-align: center;
}

/* Utilitários usados no sistema */
.float-sm-right {
  float: right;
}

.clearfix::after {
  content: "";
  clear: both;
  display: table;
}

.px-2 {
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.hand {
  cursor: pointer;
}

/* Erro de página */
.app-page-error {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 18px;
  border-radius: 12px;
  font-weight: 700;
}

/* Mobile */
.app-mobile-menu {
  display: none;
}

@media (max-width: 991px) {
  .sidebar,
  .app-sidebar {
    transform: translateX(-100%);
    transition: 0.2s ease;
  }

  .sidebar.active,
  .app-sidebar.active,
  .sidebar-offcanvas.active {
    transform: translateX(0);
  }

  .main-panel,
  .app-main-panel {
    width: 100%;
    margin-left: 0;
  }

  .content-wrapper,
  .app-content-wrapper {
    padding: 72px 16px 22px;
  }

  .app-mobile-menu {
    display: inline-flex;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 9999;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: var(--efex-primary);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
  }

  .app-mobile-menu i {
    font-size: 24px;
  }

  .col-xl-9,
  .col-xl-10 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .float-sm-right {
    float: none;
  }
}

@media (max-width: 575px) {
  .content-wrapper,
  .app-content-wrapper {
    padding-left: 12px;
    padding-right: 12px;
  }

  .card-body {
    padding: 16px;
  }

  .btn-group {
    width: 100%;
  }
}