body.theme-modern {
  --theme-surface: #ffffff;
  --theme-background: #f7f8f6;
  --theme-border: #e1e6e1;
  --theme-text: #242b29;
  --theme-muted: #6b7772;
  --theme-accent: #d84935;
  --theme-accent-hover: #b93425;
  --theme-accent-soft: #fff0eb;
  --theme-positive: #218b72;
  --theme-positive-hover: #176d59;
  --theme-nav: #252d2b;
  --theme-nav-hover: #343d39;
  --theme-nav-text: #eef3f0;
  --theme-nav-muted: #aab8b2;
  --theme-nav-active: #49312d;
  --theme-nav-active-text: #ff9a87;
  --theme-shadow: 0 8px 22px rgba(36, 43, 41, 0.09);
  color-scheme: light;
}

body.theme-modern.theme-dark {
  --theme-surface: #202825;
  --theme-background: #151b19;
  --theme-border: #394541;
  --theme-text: #eaf0ed;
  --theme-muted: #a5b2ac;
  --theme-accent: #ff806a;
  --theme-accent-hover: #ff9a88;
  --theme-accent-soft: #482d29;
  --theme-positive: #4eb995;
  --theme-positive-hover: #70d0ab;
  --theme-nav: #101614;
  --theme-nav-hover: #202a26;
  --theme-nav-text: #eaf0ed;
  --theme-nav-muted: #a5b2ac;
  --theme-nav-active: #482d29;
  --theme-nav-active-text: #ffab9b;
  --theme-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  color-scheme: dark;
}

body.theme-modern[data-theme-palette="jade"] {
  --theme-background: #f2f7f4;
  --theme-border: #d6e4dc;
  --theme-text: #20352d;
  --theme-muted: #647a6e;
  --theme-accent: #16856f;
  --theme-accent-hover: #0f6758;
  --theme-accent-soft: #e3f3ed;
  --theme-positive: #218b72;
  --theme-positive-hover: #176d59;
  --theme-nav: #173b35;
  --theme-nav-hover: #245047;
  --theme-nav-active: #dff2ea;
  --theme-nav-active-text: #125a4d;
  --theme-nav-muted: #b3c9bf;
}

body.theme-modern.theme-dark[data-theme-palette="jade"] {
  --theme-surface: #1c2b25;
  --theme-background: #111b16;
  --theme-border: #354a3f;
  --theme-text: #e5f0e9;
  --theme-muted: #a3b8aa;
  --theme-accent: #65c5a5;
  --theme-accent-hover: #86d8bb;
  --theme-accent-soft: #203b30;
  --theme-positive: #65c5a5;
  --theme-positive-hover: #86d8bb;
  --theme-nav: #101914;
  --theme-nav-hover: #20342a;
  --theme-nav-active: #244638;
  --theme-nav-active-text: #9be0c5;
  --theme-nav-muted: #a3b8aa;
}

body.theme-modern[data-theme-palette="jade"] {
  --theme-accent: #16856f;
  --theme-accent-hover: #0f6758;
  --theme-accent-soft: #e3f3ed;
}

body.theme-modern #content {
  background-color: var(--theme-background) !important;
  color: var(--theme-text);
}

body.theme-modern #sidebar {
  background: var(--theme-nav) !important;
  border-right: 1px solid var(--theme-border);
  box-shadow: 4px 0 18px rgba(23, 31, 28, 0.12);
}

body.theme-modern #sidebar::before {
  width: 5px;
  background: var(--theme-accent);
}

body.theme-modern .sidebar-header {
  background: var(--theme-nav) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.theme-modern #sidebar .menu-item {
  border-radius: 6px;
  color: var(--theme-nav-text) !important;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

body.theme-modern #sidebar .menu-item::before {
  background: var(--theme-accent);
}

body.theme-modern #sidebar .menu-item:hover {
  background: var(--theme-nav-hover);
  color: #ffffff !important;
  box-shadow: none;
  transform: translateX(3px);
}

body.theme-modern #sidebar .menu-item.active {
  background: var(--theme-nav-active);
  color: var(--theme-nav-active-text) !important;
  box-shadow: inset 3px 0 var(--theme-accent);
  font-weight: 700;
}

body.theme-modern #sidebar .menu-icon,
body.theme-modern #sidebar .menu-arrow {
  color: var(--theme-nav-muted);
  transition: color 160ms ease, transform 160ms ease;
}

body.theme-modern #sidebar .menu-item:hover .menu-icon,
body.theme-modern #sidebar .menu-item.active .menu-icon {
  color: var(--theme-accent-hover);
  transform: scale(1.08);
}

body.theme-modern #sidebar .submenu {
  background: rgba(0, 0, 0, 0.12);
}

body.theme-modern .menuSuperior {
  background-color: var(--theme-surface) !important;
  border-bottom: 1px solid var(--theme-border);
  box-shadow: 0 2px 10px rgba(36, 43, 41, 0.04);
}

body.theme-modern .container-site {
  background-color: transparent !important;
}

body.theme-modern .card,
body.theme-modern .modal-content,
body.theme-modern .dropdown-menu,
body.theme-modern .list-group-item {
  background-color: var(--theme-surface);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

body.theme-modern .card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body.theme-modern .card:hover {
  border-color: color-mix(in srgb, var(--theme-accent) 38%, var(--theme-border));
  box-shadow: var(--theme-shadow);
}

body.cards-soft .card {
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(36, 43, 41, 0.045);
}

body.theme-modern:not(.cards-soft) .card {
  border-radius: 2px;
  box-shadow: none;
}

body.theme-modern .form-control,
body.theme-modern .form-select {
  border-color: var(--theme-border);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

body.theme-modern .form-control:focus,
body.theme-modern .form-select:focus,
body.theme-modern .form-check-input:focus {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 0.22rem color-mix(in srgb, var(--theme-accent) 23%, transparent);
}

body.theme-modern .form-check-input:checked {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
}

body.theme-modern .btn {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

body.theme-modern .btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 43, 41, 0.14);
}

body.theme-modern .btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: none;
}

body.theme-modern .btn:focus-visible,
body.theme-modern a:focus-visible,
body.theme-modern button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-accent) 48%, transparent);
  outline-offset: 2px;
}

body.theme-modern .btn-primary {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
  color: #ffffff;
}

body.theme-modern .btn-primary:hover:not(:disabled) {
  background-color: var(--theme-accent-hover);
  border-color: var(--theme-accent-hover);
  color: #ffffff;
}

body.theme-modern .btn-success {
  background-color: var(--theme-positive);
  border-color: var(--theme-positive);
}

body.theme-modern .btn-success:hover:not(:disabled) {
  background-color: var(--theme-positive-hover);
  border-color: var(--theme-positive-hover);
}

body.theme-modern .text-success {
  color: var(--theme-positive) !important;
}

body.theme-modern .bg-success {
  background-color: var(--theme-positive) !important;
}

body.theme-modern .border-success {
  border-color: var(--theme-positive) !important;
}

body.theme-modern .btn-outline-secondary,
body.theme-modern .btn-outline-light {
  border-color: var(--theme-border);
  color: var(--theme-text);
}

body.theme-modern .btn-outline-secondary:hover,
body.theme-modern .btn-outline-light:hover {
  background: var(--theme-accent-soft);
  border-color: var(--theme-accent);
  color: var(--theme-accent-hover);
}

body.theme-modern a:not(.btn):not(.menu-item) {
  color: var(--theme-accent-hover);
  text-decoration-color: transparent;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

body.theme-modern a:not(.btn):not(.menu-item):hover {
  color: var(--theme-accent);
  text-decoration-color: currentColor;
}

body.theme-modern .table {
  --bs-table-color: var(--theme-text);
  --bs-table-bg: var(--theme-surface);
  --bs-table-border-color: var(--theme-border);
  --bs-table-striped-color: var(--theme-text);
  --bs-table-striped-bg: color-mix(in srgb, var(--theme-accent) 4%, var(--theme-surface));
  --bs-table-hover-color: var(--theme-text);
  --bs-table-hover-bg: color-mix(in srgb, var(--theme-accent) 11%, var(--theme-surface));
  --bs-table-active-bg: var(--theme-accent-soft);
  --bs-table-active-color: var(--theme-text);
  border-color: var(--theme-border);
}

body.theme-modern .table > :not(caption) > * > * {
  border-bottom-color: var(--theme-border);
}

body.theme-modern .table-hover tbody tr {
  transition: background-color 130ms ease;
}

body.tables-clean .table {
  font-size: 0.9rem;
  border-collapse: separate;
  border-spacing: 0;
}

body.tables-clean .table thead th {
  color: var(--theme-muted, #667b76);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

body.tables-clean .table > :not(caption) > * > * {
  padding: 0.72rem 0.8rem;
}

body.filters-advanced .filters-card,
body.filters-advanced .filters-panel,
body.filters-advanced .filter-card,
body.filters-advanced .filter-panel {
  border-inline-start: 3px solid var(--theme-accent, #d84935);
  border-radius: 6px;
}

body.icons-modern #sidebar .menu-icon,
body.icons-modern #content .bi {
  font-size: 1.08em;
  transition: color 160ms ease, transform 160ms ease;
}

body.type-consistent #content {
  font-family: Inter, ui-sans-serif, sans-serif;
}

body.type-consistent #content :is(h1, h2, h3, h4, h5, label, th, .form-label) {
  letter-spacing: 0;
}

body.theme-modern:not(.microinteractions) .btn,
body.theme-modern:not(.microinteractions) .card,
body.theme-modern:not(.microinteractions) #sidebar .menu-item,
body.theme-modern:not(.microinteractions) .form-control,
body.theme-modern:not(.microinteractions) .form-select {
  transition: none !important;
}

body.theme-modern:not(.microinteractions) .btn:hover:not(:disabled),
body.theme-modern:not(.microinteractions) .btn:active:not(:disabled),
body.theme-modern:not(.microinteractions) .card:hover,
body.theme-modern:not(.microinteractions) #sidebar .menu-item:hover {
  transform: none;
  box-shadow: none;
}

body.header-compact .navbar.menuSuperior {
  height: 46px;
  min-height: 46px;
  padding-top: 2px;
  padding-bottom: 2px;
}

body.header-compact #content {
  padding-top: 46px;
}

body.header-compact .menuSuperior .container-fluid {
  min-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

body.sidebar-compact:not(.sidebar-open-mobile) #sidebar {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
}

body.sidebar-compact:not(.sidebar-open-mobile) #sidebar + #content,
body.sidebar-compact:not(.sidebar-open-mobile) #sidebar ~ #content {
  width: calc(100% - 78px);
  max-width: calc(100% - 78px);
  margin-left: 78px;
}

body.sidebar-compact:not(.sidebar-open-mobile) #sidebar ~ #content .navbar {
  left: 78px;
  width: calc(100% - 78px);
}

body.sidebar-compact #sidebar > ul > li > a > .menu-text,
body.sidebar-compact #sidebar > ul > li > a > .menu-arrow {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.sidebar-compact #sidebar > ul > li > a.menu-item {
  justify-content: center;
  padding-inline: 0.5rem !important;
}

body.sidebar-compact #sidebar > ul > li > a.menu-item .menu-icon {
  margin: 0;
}

body.sidebar-compact #sidebar > ul > li.menu > .submenu {
  position: absolute;
  top: 0;
  left: 100%;
  z-index: 1040;
  width: 230px;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--theme-surface, #ffffff);
  box-shadow: 0 8px 24px rgba(20, 35, 30, 0.2);
}

@media (max-width: 800px) {
  body.sidebar-compact #sidebar {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
  }

  body.sidebar-compact #sidebar + #content,
  body.sidebar-compact #sidebar ~ #content {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  body.sidebar-compact #sidebar ~ #content .navbar {
    left: 0;
    width: 100%;
  }

  body.sidebar-compact #sidebar {
    width: min(82vw, 250px);
    min-width: min(82vw, 250px);
    max-width: min(82vw, 250px);
  }

  body.sidebar-compact #sidebar > ul > li > a > .menu-text,
  body.sidebar-compact #sidebar > ul > li > a > .menu-arrow {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: revert !important;
    margin: revert !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border: revert !important;
  }

  body.sidebar-compact #sidebar > ul > li > a.menu-item {
    justify-content: flex-start;
    padding-inline: 1.25rem !important;
  }

  body.sidebar-compact #sidebar > ul > li > a.menu-item .menu-icon {
    margin-right: 0.75rem;
  }
}

body:not(.microinteractions) .btn,
body:not(.microinteractions) .card,
body:not(.microinteractions) #sidebar .menu-item,
body:not(.microinteractions) .form-control,
body:not(.microinteractions) .form-select {
  transition: none !important;
}

body:not(.microinteractions) .btn:hover:not(:disabled),
body:not(.microinteractions) .btn:active:not(:disabled),
body:not(.microinteractions) .card:hover,
body:not(.microinteractions) #sidebar .menu-item:hover {
  transform: none;
  box-shadow: none;
}

body.theme-modern .nav-pills .nav-link.active,
body.theme-modern .nav-tabs .nav-link.active,
body.theme-modern .page-item.active .page-link {
  background-color: var(--theme-accent);
  border-color: var(--theme-accent);
  color: #ffffff;
}

body.theme-modern .nav-link:not(.active):hover,
body.theme-modern .dropdown-item:hover,
body.theme-modern .list-group-item-action:hover {
  background-color: var(--theme-accent-soft);
  color: var(--theme-accent-hover);
}

body.theme-modern .alert {
  border-left: 4px solid var(--theme-accent);
}

body.theme-modern.theme-dark .form-control,
body.theme-modern.theme-dark .form-select {
  background-color: var(--theme-surface);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

body.theme-modern.theme-dark .form-control::placeholder {
  color: var(--theme-muted);
}

body.theme-modern ::selection {
  background: var(--theme-accent);
  color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  body.theme-modern *,
  body.theme-modern *::before,
  body.theme-modern *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
