body {
  font-family: var(--app-font-family, var(--font-family, 'Poppins', sans-serif));
  background-color: var(--background-color, #f8f9fa);
  color: var(--text-color, #0f2a3d);
}

.dashboard-flex {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  background-color: var(--sidebar-background-color, #004252);
  color: #ffffff;
  width: 240px;
  min-height: 100vh;
  overflow-y: auto;
  transition: width 0.3s ease, left 0.3s ease;
}

.sidebar .sidebar-logo-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--header-height, 84px);
  padding: 0 0.75rem;
  background-color: rgba(255, 255, 255, 0.92);
}

.sidebar .logo-expand {
  max-height: 36px;
  width: auto;
}

.sidebar .logo-collapsed {
  display: none;
  max-height: 36px;
  width: auto;
}

.sidebar .sidebar-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.sidebar .sidebar-logo-title {
  color: var(--header-text-color, #004252);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.order-detail-header {
  background-color: var(--sidebar-background-color, #004252);
  color: rgba(255, 255, 255, 0.75);
  border-bottom: none;
}

.order-detail-header h4 {
  color: rgba(255, 255, 255, 0.75);
}

.order-detail-header .badge.order-status-badge {
  background-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 600;
}

.invoice-detail-header {
  background-color: var(--sidebar-background-color, #004252);
  color: #ffffff;
}

.invoice-detail-header .card-body {
  background-color: transparent;
}

.invoice-detail-header .btn-outline-light {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
}

.invoice-detail-header .btn-outline-light:hover,
.invoice-detail-header .btn-outline-light:focus {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sidebar .nav {
  padding: 0 0.5rem 1.5rem;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 0.4rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .nav-link .navlink-icon {
  font-size: 1.1rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus,
.sidebar .nav-link.active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.sidebar-collapsed {
  width: 68px;
}

.sidebar-collapsed .logo-expand {
  display: none;
}

.sidebar-collapsed .logo-collapsed {
  display: inline-block;
}

.sidebar-collapsed .sidebar-text {
  display: none;
}

.sidebar-collapsed .sidebar-logo-title {
  display: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1030;
}

.sidebar-backdrop.show {
  display: block !important;
}

.flex-main-area {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header {
  min-height: var(--header-height, 84px);
}

.navbar.header {
  min-height: var(--header-height, 84px);
  padding-block: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
  background-color: #ffffff;
  box-shadow: 0 1px 6px rgba(15, 42, 61, 0.1);
  position: sticky;
  top: 0;
  z-index: 1020;
  color: var(--header-text-color, #004252);
}

.navbar.header h4,
.navbar.header .navbar-brand,
.navbar.header .nav-link {
  color: var(--header-text-color, #004252) !important;
}

#sidebarToggle,
#sidebarToggleMobile {
  color: var(--header-text-color, #004252);
}

.user-dropdown-menu {
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(15, 42, 61, 0.12);
}

.user-dropdown-menu .dropdown-item {
  font-size: 0.9rem;
}

.role-badge {
  background: var(--primary-color, #4ab16c);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.75rem;
  text-transform: uppercase;
  margin-left: 0.35rem;
}

.role-badge.owner {
  background: var(--success-color, #198754);
}

.role-badge.user {
  background: #6c757d;
}

.main-content {
  flex: 1 1 auto;
  padding: 1.5rem;
  overflow-y: auto;
  background-color: var(--background-color, #f8f9fa);
}

.main-content .page-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--header-text-color, #004252);
}

.card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 12px 30px rgba(15, 42, 61, 0.08);
}

.card-header,
.card-title {
  font-weight: 600;
  color: var(--header-text-color, #004252);
}

.btn-primary {
  background-color: var(--primary-color, #4ab16c);
  border-color: var(--primary-color, #4ab16c);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-hover, #369a56);
  border-color: var(--primary-hover, #369a56);
}

.table thead th {
  color: var(--header-text-color, #004252);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(15, 42, 61, 0.1);
}

.table-hover tbody tr:hover {
  background-color: rgba(74, 177, 108, 0.06);
}

.badge-status {
  border-radius: 0.4rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
}

.pagination .page-link {
  color: var(--primary-color, #4ab16c);
  border: none;
}

.pagination .page-link:hover,
.pagination .page-item.active .page-link {
  background-color: var(--primary-color, #4ab16c);
  color: #ffffff;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100vh;
    z-index: 1040;
  }

  .sidebar.sidebar-open {
    left: 0;
  }

  .sidebar-collapsed {
    width: 240px;
  }

  .sidebar-collapsed .sidebar-text {
    display: inline;
  }

  .flex-main-area {
    min-height: 100vh;
  }
}

@media (max-width: 575.98px) {
  .navbar.header h4 {
    font-size: 1.15rem;
  }

  .sidebar {
    width: 220px;
  }
}

/* Alert styling */
#alerts-container {
  max-width: 640px;
  margin: 0 auto 1.5rem;
}

.modern-alert {
  background: #ffffff;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 10px 25px rgba(15, 42, 61, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid var(--primary-color, #4ab16c);
}

.modern-alert.alert-danger {
  border-left-color: var(--error-color, #dc3545);
}

.modern-alert.alert-warning {
  border-left-color: var(--warning-color, #ffc107);
}

.modern-alert.alert-info {
  border-left-color: var(--accent-color, #0dcaf0);
}

.modern-alert .btn-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  opacity: 0.6;
}

.modern-alert .btn-close:hover {
  opacity: 1;
}

.footer {
  color: rgba(15, 42, 61, 0.6);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 2.5rem;
}

/* Auth layout overrides */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, rgba(0, 66, 82, 0.92), rgba(74, 177, 108, 0.9));
  padding: 2rem 1rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 1.5rem;
  max-width: 960px;
  margin: auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}

.auth-card__brand {
  background: rgba(0, 0, 0, 0.05);
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #004252;
}

.auth-card__brand h1 {
  font-weight: 600;
  font-size: 2rem;
}

.auth-card__brand p {
  color: rgba(0, 66, 82, 0.8);
  line-height: 1.6;
}

.auth-card__form {
  padding: 3rem 2.5rem;
}

.auth-card__logo img {
  max-height: 48px;
  width: auto;
}

.auth-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--header-text-color, #004252);
}

.auth-subtitle {
  color: rgba(15, 42, 61, 0.7);
  margin-bottom: 2rem;
}

.auth-form .form-label {
  font-weight: 500;
  color: var(--header-text-color, #004252);
}

.auth-form .form-control {
  border-radius: 0.65rem;
  padding: 0.75rem 1rem;
}

.auth-form .btn-primary {
  width: 100%;
  padding: 0.75rem;
  font-weight: 600;
}

.auth-form .form-text,
.auth-form .form-link {
  color: rgba(15, 42, 61, 0.7);
}

.auth-form .form-link:hover {
  color: var(--primary-color, #4ab16c);
}

.auth-footer {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: rgba(15, 42, 61, 0.7);
}

@media (max-width: 991.98px) {
  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-card__brand {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .auth-card__form {
    padding: 2rem 1.5rem;
  }
}
