
body {
  background-color: #f4f4f9;
  font-family: Arial, sans-serif;
  margin: 0;
  overflow-x: hidden;
}

/* =====================================================
   GLOBALNE STYLE PRZYCISKÓW - NAPRAWA KOLORU HOVER
   Przyciski outline muszą mieć biały tekst po hover
   ===================================================== */
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  color: #fff !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
  color: #fff !important;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success:active {
  color: #fff !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:active {
  color: #fff !important;
}

.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active {
  color: #212529 !important; /* ciemny tekst na żółtym tle */
}

.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-info:active {
  color: #fff !important;
}

.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-outline-dark:active {
  color: #fff !important;
}

.btn-outline-light:hover,
.btn-outline-light:focus,
.btn-outline-light:active {
  color: #212529 !important; /* ciemny tekst na jasnym tle */
}

/* Mobile - minimalne odstępy dla maksymalnego wykorzystania przestrzeni */
@media (max-width: 768px) {
  .mobile-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    margin-top: 0.5rem !important;
  }
  
  .container-fluid.mobile-container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .page-header {
    margin-bottom: 0.75rem !important;
  }
  
  .page-header h1 {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem !important;
  }
  
  .card {
    margin-bottom: 0.75rem !important;
  }
  
  .card-body {
    padding: 0.75rem !important;
  }
  
  .card-header {
    padding: 0.5rem 0.75rem !important;
  }
  
  .mb-4 {
    margin-bottom: 0.75rem !important;
  }
  
  .mt-4 {
    margin-top: 0.75rem !important;
  }
  
  .mb-3 {
    margin-bottom: 0.5rem !important;
  }
  
  .mt-3 {
    margin-top: 0.5rem !important;
  }
  
  .px-3 {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  
  .py-3 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }
  
  .p-3 {
    padding: 0.5rem !important;
  }
  
  .p-4 {
    padding: 0.75rem !important;
  }
  
  .gap-2 {
    gap: 0.25rem !important;
  }
  
  .gap-3 {
    gap: 0.5rem !important;
  }
  
  /* Zmniejsz odstępy w formularzach */
  .form-group {
    margin-bottom: 0.75rem !important;
  }
  
  .row {
    margin-left: -0.25rem !important;
    margin-right: -0.25rem !important;
  }
  
  .row > * {
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
  }
  
  /* Zmniejsz odstępy w tabelach */
  .table {
    margin-bottom: 0.5rem !important;
  }
  
  .table td, .table th {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Zmniejsz odstępy w przyciskach */
  .btn {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Zmniejsz odstępy w alertach */
  .alert {
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.5rem !important;
  }
}

.sidebar-separator {
  border: none;
  border-top: 2px solid #e9ecef;
  margin: 12px 16px;
  opacity: 0.6;
  border-radius: 1px;
}

/* Style dla elementów menu */
.list-group-item {
  border: none;
  border-radius: 8px;
  margin: 2px 8px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  color: #495057;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.list-group-item:hover {
  background-color: rgba(0, 123, 255, 0.1);
  color: var(--brand-primary, #007bff);
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.list-group-item:active {
  transform: translateX(1px);
  background-color: #bbdefb;
}

/* Ujednolicenie wyglądu aktywnego linku w menu (bez pogrubienia, bez skoków odstępów) */
.list-group-item.active,
.list-group-item.active:focus,
.list-group-item.active:hover {
  background-color: rgba(0, 123, 255, 0.1) !important;
  color: var(--brand-primary, #007bff) !important;
  font-weight: 500 !important; /* zapobiega bold */
  transform: none !important;  /* bez przesunięcia */
  box-shadow: none !important;
}

/* Tekst w menu – zawsze ta sama waga i odstępy */
.list-group-item .menu-text,
.list-group-item.active .menu-text {
  font-weight: 500 !important;
}

/* Ikona o stałej szerokości, żeby nie "skakał" odstęp */
.list-group-item i {
  width: 22px; /* lekko większa, stała szerokość */
}

.list-group-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  transition: all 0.2s ease;
}

.list-group-item:hover i {
  transform: scale(1.1);
}

/* Licznik nowych zamówień */
.list-group-item .badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
  min-width: 1.2rem;
  text-align: center;
  transition: opacity 0.3s ease;
}

.list-group-item .badge.bg-danger {
  background-color: #dc3545 !important;
  color: white;
  animation: pulse 2s infinite;
}

/* Ukryj badge gdy menu jest zwinięte */
#sidebar-wrapper.collapsed .list-group-item .badge {
  opacity: 0;
  visibility: hidden;
}

/* Wyrównaj ikony gdy badge jest ukryty */
#sidebar-wrapper.collapsed .list-group-item {
  justify-content: flex-start;
}

#sidebar-wrapper.collapsed .list-group-item .badge {
  display: none;
}


@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

html, body {
  height: 100%;
}

.layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

#sidebar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  overflow: visible;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
  border-right: 1px solid #e9ecef;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: all 0.3s ease;
}

#sidebar-wrapper.collapsed {
  width: 70px;
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
}

.main-content {
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  position: relative;
}

body.sidebar-collapsed .main-content {
  margin-left: 70px;
}

#page-content-wrapper {
  flex: 1;
  padding: 20px;
}

/* Sidebar links */
.list-group-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  font-size: 15px;
  border: none;
  background-color: transparent;
  color: #212529;
  text-decoration: none;
  transition: background-color 0.2s;
}

.list-group-item:hover {
  background-color: #e9ecef;
  color: var(--brand-primary, #007bff);
  text-decoration: none;
}

.list-group-item:focus,
.list-group-item:active {
  background-color: #dee2e6;
  color: var(--brand-primary, #007bff);
}

.list-group-item i {
  font-size: 18px;
}

.menu-text {
  transition: opacity 0.3s, width 0.3s;
  white-space: nowrap;
}

#sidebar-wrapper.collapsed .list-group-item {
  justify-content: center;
  padding: 12px 8px;
  margin: 2px 4px;
  border-radius: 6px;
}

#sidebar-wrapper.collapsed .menu-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  display: inline-block;
}

/* Uniwersalne ukrywanie tekstu w collapsed - dla wszystkich menu-text */
#sidebar-wrapper.collapsed .menu-text-produkcja,
#sidebar-wrapper.collapsed .menu-text-zamowienia,
#sidebar-wrapper.collapsed .menu-text-oferty,
#sidebar-wrapper.collapsed .menu-text-materialy,
#sidebar-wrapper.collapsed .menu-text {
  opacity: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  display: inline-block !important;
  transition: opacity 0.3s, width 0.3s !important;
}

/* Stały pas na logo — toggle zawsze na środku wysokości, także gdy logo znika */
.sidebar-header {
  position: relative;
  flex-shrink: 0;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e9ecef;
  overflow: visible;
  z-index: 2000;
}

.sidebar-header .sidebar-logo {
  margin-bottom: 0;
  border-bottom: none;
  padding: 0 16px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toggle button: połówka w sidebarze, połówka w content — środek pasu logo */
.sidebar-toggle-button {
  position: absolute;
  top: 50%;
  right: -15px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-primary, #007bff);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
  border: 2px solid #ffffff;
  z-index: 2001;
  cursor: pointer;
  transition: box-shadow 0.3s ease, opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  color: white;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.sidebar-toggle-button:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
  opacity: 0.9;
}

/* Ikona – kolor i obrót */
#toggle-icon {
  transition: transform 0.3s, color 0.2s;
  color: white;
  font-size: 0.9rem;
}

.sidebar-toggle-button:hover #toggle-icon {
  color: white;
  transform: scale(1.1);
}

.footer {
  background-color: var(--brand-primary, #007bff);
  color: white;
  text-align: center;
  padding: 10px;
  width: 100%;
}
.sidebar-toggle-button.btn-primary {
  background-color: transparent;
  color: var(--brand-primary, #007bff);
  border: 1px solid #ddd; /* <- subtelna ramka */
  box-shadow: none;
  margin-bottom: 0;
  border-radius: 50%;
  background-color: #f8f9fa;
}

.sidebar-toggle-button.btn-primary:hover {
  background-color: #dee2e6;
  border-color: 	#aaa;
}

/* Nadpisanie globalnego .btn-primary z base.html (!important) — wygląd jak desktop */
#menu-toggle.sidebar-toggle-button.btn-primary {
  background-color: #f8f9fa !important;
  border: 1px solid #dee2e6 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
  color: var(--brand-primary, #007bff) !important;
}

#menu-toggle.sidebar-toggle-button.btn-primary:hover,
#menu-toggle.sidebar-toggle-button.btn-primary:focus-visible,
#menu-toggle.sidebar-toggle-button.btn-primary:active {
  background-color: #dee2e6 !important;
  border-color: #aaa !important;
  opacity: 1 !important;
}

#menu-toggle.sidebar-toggle-button.btn-primary:focus:not(:focus-visible) {
  background-color: #f8f9fa !important;
  border-color: #dee2e6 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}

#menu-toggle.sidebar-toggle-button #toggle-icon {
  color: var(--brand-primary, #007bff) !important;
}

#menu-toggle.sidebar-toggle-button:hover #toggle-icon {
  color: var(--brand-primary, #007bff) !important;
}

.sidebar-logo img {
  max-width: 120px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
}

#sidebar-wrapper.collapsed .sidebar-header .sidebar-logo {
  display: none;
}

/* Zwinięty sidebar — bez pustego pasu pod logo; toggle przy górze menu */
#sidebar-wrapper.collapsed .sidebar-header {
  height: 0 !important;
  min-height: 0 !important;
  border-bottom: none !important;
  padding: 0 !important;
}

#sidebar-wrapper.collapsed .sidebar-toggle-button {
  top: 14px;
  transform: translateY(0);
}

#sidebar-wrapper.collapsed .sidebar-toggle-button:hover {
  transform: scale(1.1);
}
.layout {
  display: flex;
  min-height: 100vh;
}

#sidebar-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background-color: #f8f9fa;
  border-right: 1px solid #dee2e6;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: width 0.3s;
  overflow: visible;
}

#sidebar-wrapper.collapsed {
  width: 60px;
}

.main-content {
  margin-left: 250px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s;
}

body.sidebar-collapsed .main-content {
  margin-left: 60px;
}
#sidebar-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* ← kluczowa zmiana */
  width: 250px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background-color: #f8f9fa;
  border-right: 1px solid #dee2e6;
  z-index: 1000;
  transition: width 0.3s;
  overflow: visible;
}

#sidebar-wrapper.collapsed {
  width: 60px;
}

.sidebar-scrollable {
  flex-grow: 1;
  overflow-y: auto;
  /* Ukryj scrollbar ale zachowaj funkcjonalność przewijania */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.sidebar-scrollable::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.sidebar-footer {
  margin-bottom: 0px;
  border-top: 1px solid #e9ecef;
  padding: 8px 0;
  background-color: #f8f9fa;
  flex-shrink: 0; /* Zapobiega zmniejszaniu się footera */
  margin-top: auto; /* Wypycha footer na dół */
}

.sidebar-footer .list-group-item {
  border: none;
  border-radius: 6px;
  margin: 2px 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: #6c757d;
  transition: all 0.2s ease;
}

.sidebar-footer .list-group-item:hover {
  background-color: #e9ecef;
  color: #495057;
  transform: translateX(1px);
}

.sidebar-footer .list-group-item.disabled {
  color: #495057;
  font-weight: 600;
  background-color: transparent;
}

.sidebar-logo img {
  max-width: 160px;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
#page-content-wrapper .container-fluid > .alert {
  margin-left: auto;
  margin-right: auto;
  max-width: 600px; /* opcjonalnie, aby alert nie był zbyt szeroki */
  text-align: center;
}

/* ===== RESPONSYWNOŚĆ MOBILE ===== */

/* Tablet (768px i mniej) */
@media (max-width: 768px) {
  /* Sidebar na mobile - zawsze zwinięty */
  #sidebar-wrapper {
    width: 60px !important;
    z-index: 1000;
    display: flex;
    flex-direction: column;
  }
  
  #sidebar-wrapper:not(.collapsed) {
    width: 200px !important; /* Szerokość dla rozwiniętego menu na mobile */
  }
  
  /* Ukryj tekst menu na mobile tylko gdy collapsed */
  #sidebar-wrapper.collapsed .menu-text {
    display: none !important;
  }
  
  /* Pokaż tekst gdy menu jest rozwinięte na mobile */
  #sidebar-wrapper:not(.collapsed) .menu-text {
    display: inline-block !important;
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important;
  }
  
  /* Dostosuj ikony */
  .list-group-item {
    justify-content: flex-start !important; /* Zmienione z center na flex-start dla rozwiniętego menu */
    padding: 0.75rem 0.5rem !important;
  }
  
  /* Gdy menu jest zwinięte - wycentruj ikony */
  #sidebar-wrapper.collapsed .list-group-item {
    justify-content: center !important;
  }
  
  /* Gdy menu jest rozwinięte - wyrównaj do lewej */
  #sidebar-wrapper:not(.collapsed) .list-group-item {
    justify-content: flex-start !important;
  }
  
  /* Logo: ten sam pas co desktop; przy zwinięciu znika, toggle zostaje na środku */
  #sidebar-wrapper.collapsed .sidebar-header .sidebar-logo {
    display: none !important;
  }
  
  #sidebar-wrapper:not(.collapsed) .sidebar-header .sidebar-logo {
    display: flex !important;
  }

  /* Mniejszy toggle na mobile — ta sama pozycja (środek pasu logo) */
  .sidebar-toggle-button {
    right: -12px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: 0.7rem;
  }

  #menu-toggle.sidebar-toggle-button #toggle-icon {
    font-size: 0.7rem;
  }

  .sidebar-header {
    height: 72px;
  }

  /* Lżejsza typografia menu na mobile */
  #sidebar-wrapper .list-group-item,
  #sidebar-wrapper .list-group-item .menu-text,
  #sidebar-wrapper .list-group-item.active,
  #sidebar-wrapper .list-group-item.active .menu-text,
  #sidebar-wrapper .menu-text-produkcja,
  #sidebar-wrapper .menu-text-zamowienia,
  #sidebar-wrapper .menu-text-oferty,
  #sidebar-wrapper .menu-text-materialy {
    font-weight: 400 !important;
  }
  
  /* Main content na mobile */
  .main-content {
    margin-left: 60px !important;
  }
  
  /* Gdy menu jest rozwinięte na mobile - dostosuj main-content */
  body:not(.sidebar-collapsed) .main-content {
    margin-left: 200px !important;
  }
  
  /* Ukryj badge na mobile */
  .list-group-item .badge {
    display: none !important;
  }
  
  /* Footer zawsze na dole na mobile */
  .sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 8px 0;
    margin: 0;
  }
  
  .sidebar-footer .list-group-item {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.8rem;
    margin: 1px 4px;
  }
  
  /* Dostosuj separator */
  .sidebar-separator {
    margin: 4px 0;
  }
  
  /* Scrollable area dla menu */
  .sidebar-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 80px; /* Miejsce na footer */
    /* Ukryj scrollbar ale zachowaj funkcjonalność przewijania */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
  }
  
  .sidebar-scrollable::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
}

/* Mobile (576px i mniej) */
@media (max-width: 576px) {
  /* Jeszcze mniejszy sidebar */
  #sidebar-wrapper {
    width: 50px !important;
  }
  
  .main-content {
    margin-left: 50px !important;
  }
  
  /* Mniejsze ikony - spójne wyrównanie */
  .list-group-item i {
    font-size: 1rem;
    width: 22px; /* Stała szerokość dla wyrównania */
    text-align: center;
    display: inline-block;
    vertical-align: middle;
  }
  
  /* Spójne wyrównanie elementów menu w mobile */
  .list-group-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.3rem !important;
  }
  
  .list-group-item .menu-text {
    margin-left: 8px;
    flex: 1;
    opacity: 1;
    width: auto;
    overflow: visible;
    display: inline-block;
  }
  
  /* Mniejszy toggle — pozycja bez zmian (środek .sidebar-header) */
  .sidebar-toggle-button {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    font-size: 0.65rem;
    right: -11px;
  }

  #menu-toggle.sidebar-toggle-button #toggle-icon {
    font-size: 0.65rem;
  }

  .sidebar-header {
    height: 68px;
  }
  
  /* Mniejszy padding */
  .list-group-item {
    padding: 0.5rem 0.25rem !important;
  }
  
  /* Footer na mobile - zawsze na dole */
  .sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 6px 0;
    margin: 0;
  }
  
  .sidebar-footer .list-group-item {
    padding: 0.4rem 0.2rem !important;
    font-size: 0.7rem;
    margin: 1px 2px;
  }
  
  /* Scrollable area dla menu */
  .sidebar-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 70px; /* Miejsce na footer */
    /* Ukryj scrollbar ale zachowaj funkcjonalność przewijania */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
  }
  
  .sidebar-scrollable::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
}

/* Bardzo małe ekrany (480px i mniej) */
@media (max-width: 480px) {
  /* Minimalny sidebar */
  #sidebar-wrapper {
    width: 45px !important;
  }
  
  .main-content {
    margin-left: 45px !important;
  }
  
  /* Jeszcze mniejsze elementy */
  .list-group-item {
    padding: 0.4rem 0.2rem !important;
  }
  
  .list-group-item i {
    font-size: 0.9rem;
    width: 22px; /* Stała szerokość dla wyrównania */
    text-align: center;
    display: inline-block;
    vertical-align: middle;
  }
  
  /* Spójne wyrównanie elementów menu w bardzo małych ekranach */
  .list-group-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.2rem !important;
  }
  
  .list-group-item .menu-text {
    margin-left: 6px;
    flex: 1;
    opacity: 1;
    width: auto;
    overflow: visible;
    display: inline-block;
  }
  
  .sidebar-toggle-button {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    font-size: 0.6rem;
    right: -10px;
  }

  #menu-toggle.sidebar-toggle-button #toggle-icon {
    font-size: 0.6rem;
  }

  .sidebar-header {
    height: 64px;
  }
  
  /* Footer na bardzo małych ekranach - zawsze na dole */
  .sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 4px 0;
    margin: 0;
  }
  
  .sidebar-footer .list-group-item {
    padding: 0.3rem 0.1rem !important;
    font-size: 0.6rem;
    margin: 1px 1px;
  }
  
  /* Scrollable area dla menu */
  .sidebar-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 60px; /* Miejsce na footer */
    /* Ukryj scrollbar ale zachowaj funkcjonalność przewijania */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
  }
  
  .sidebar-scrollable::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
}

/* Landscape orientation na mobile */
@media (max-width: 768px) and (orientation: landscape) {
  /* W landscape sidebar może być jeszcze mniejszy */
  #sidebar-wrapper {
    width: 50px !important;
  }
  
  .main-content {
    margin-left: 50px !important;
  }
}

/* Touch devices — większy obszar klikalny menu; toggle bez powiększania wizualnego */
@media (hover: none) and (pointer: coarse) {
  .list-group-item {
    min-height: 44px; /* Minimalna wysokość dla touch */
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-toggle-button {
    /* Nie nadpisuj width/height — zachowaj rozmiar z breakpointów mobile */
    position: absolute;
  }

  .sidebar-toggle-button::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
  }
}

/* ===== TWARDY FIX: spójna waga fontu w menu niezależnie od innych CSS ===== */
#sidebar-wrapper .list-group-item,
#sidebar-wrapper .list-group-item .menu-text {
  font-weight: 500 !important; /* blokuje przypadkowe pogrubienia */
}

#sidebar-wrapper .list-group-item.active,
#sidebar-wrapper .list-group-item.active .menu-text {
  font-weight: 500 !important; /* także dla aktywnego */
}

/* ===== BLOKADA: żadne inne CSS nie może wpływać na menu ===== */
#sidebar-wrapper .list-group-item *,
#sidebar-wrapper .list-group-item.active *,
#sidebar-wrapper .list-group-item:hover *,
#sidebar-wrapper .list-group-item:focus * {
  font-weight: inherit !important; /* dziedziczy z rodzica, nie może być nadpisane */
}

/* ===== SPECYFICZNE: blokada dla konkretnych ikon z problematycznych stron ===== */
#sidebar-wrapper .bi-hammer,
#sidebar-wrapper .bi-person-lines-fill,
#sidebar-wrapper .bi-file-earmark-text,
#sidebar-wrapper .bi-file-earmark-arrow-down {
  font-weight: normal !important;
  font-style: normal !important;
}

/* ===== ULTRA SPECYFICZNE: blokada dla wszystkich możliwych kombinacji ===== */
#sidebar-wrapper .list-group-item .menu-text,
#sidebar-wrapper .list-group-item.active .menu-text,
#sidebar-wrapper .list-group-item:hover .menu-text,
#sidebar-wrapper .list-group-item:focus .menu-text,
#sidebar-wrapper .list-group-item:visited .menu-text,
#sidebar-wrapper .list-group-item:link .menu-text,
#sidebar-wrapper .list-group-item:active .menu-text {
  font-weight: 500 !important;
  font-style: normal !important;
  text-decoration: none !important;
}

/* ===== BLOKADA: żadne inne reguły nie mogą wpływać na menu ===== */
#sidebar-wrapper .list-group-item,
#sidebar-wrapper .list-group-item *,
#sidebar-wrapper .list-group-item .menu-text,
#sidebar-wrapper .list-group-item.active,
#sidebar-wrapper .list-group-item.active *,
#sidebar-wrapper .list-group-item.active .menu-text {
  font-weight: 500 !important;
  font-family: Arial, sans-serif !important; /* blokuje dziedziczenie z body */
}

/* ===== UNIKALNE KLASY: dla problematycznych przycisków menu ===== */
#sidebar-wrapper .menu-text-produkcja,
#sidebar-wrapper .menu-text-zamowienia,
#sidebar-wrapper .menu-text-oferty,
#sidebar-wrapper .menu-text-materialy {
  font-weight: 500 !important;
  font-style: normal !important;
  text-decoration: none !important;
  font-family: Arial, sans-serif !important; /* blokuje dziedziczenie z body */
  transition: opacity 0.3s, width 0.3s;
  white-space: nowrap;
}

/* Ukryj tekst gdy sidebar jest zwinięty */
#sidebar-wrapper.collapsed .menu-text-produkcja,
#sidebar-wrapper.collapsed .menu-text-zamowienia,
#sidebar-wrapper.collapsed .menu-text-oferty,
#sidebar-wrapper.collapsed .menu-text-materialy {
  opacity: 0;
  width: 0;
  overflow: hidden;
  display: inline-block;
}

/* ===== BADGE: blokada font-weight dla liczników w menu ===== */
#sidebar-wrapper .list-group-item .badge {
  font-weight: 500 !important; /* blokuje font-weight: 600 z .danger */
  font-family: Arial, sans-serif !important; /* spójny font */
  font-size: 0.7rem !important;
  padding: 0.25rem 0.5rem !important; /* nadpisuje padding z podstron */
  border-radius: 0.375rem !important;
  line-height: 1 !important;
}
#sidebar-wrapper .list-group-item .badge.bg-danger {
  background-color: #dc3545 !important;
  color: #fff !important;
}

/* ===== Pełnoekranowy loader stron z ciężkimi listami (body.suys-list-page) ===== */
#suys-page-loader-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(244, 244, 249, 0.94);
  transition: opacity 0.28s ease, visibility 0s linear 0s;
}

body.suys-list-page #suys-page-loader-overlay {
  display: flex;
  opacity: 1;
  visibility: visible;
}

body.suys-list-page.suys-list-page--ready #suys-page-loader-overlay {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.suys-page-loader-spinner {
  width: 3rem;
  height: 3rem;
  border-width: 0.28rem;
}

.suys-page-loader-text {
  color: #495057;
  font-size: 1rem;
  font-weight: 500;
}

/* ===== Druk: usuń „margines pod sidebar” z breakpointów szerokości ===== */
/*
 * Przy podglądzie wydruku szerokość viewportu dla media queries to często
 * szerokość **strony** (~A4 minus margines), np. <768px. Wtedy nadal obowiązują
 * reguły @media (max-width: 768px) z margin-left na .main-content **!important**
 * — wyższa specyficzność niż pojedynczy `.main-content { margin: 0 !important }`
 * w szablonie → pusty pas po lewej i ucinanie tabeli po prawej.
 */
@media print {
  body:not(.sidebar-collapsed) .main-content,
  body.sidebar-collapsed .main-content,
  .main-content {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .layout {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  #page-content-wrapper {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #sidebar-wrapper {
    display: none !important;
  }
}

/* Mobile: lżejsza typografia menu (po globalnych blokadach font-weight: 500) */
@media (max-width: 768px) {
  #sidebar-wrapper .list-group-item,
  #sidebar-wrapper .list-group-item *,
  #sidebar-wrapper .list-group-item .menu-text,
  #sidebar-wrapper .list-group-item.active,
  #sidebar-wrapper .list-group-item.active *,
  #sidebar-wrapper .list-group-item.active .menu-text,
  #sidebar-wrapper .menu-text-produkcja,
  #sidebar-wrapper .menu-text-zamowienia,
  #sidebar-wrapper .menu-text-oferty,
  #sidebar-wrapper .menu-text-materialy,
  #sidebar-wrapper .menu-text-user {
    font-weight: 400 !important;
  }
}