    body {
      display: flex;
      min-height: 100vh;
      font-family: 'Kanit', 'Segoe UI', sans-serif;
      background-color: #f1f3f5;
    }

    .sidebar {
      width: 350px;
      background-color: #ffffff;
      padding: 1rem;
      border-right: 1px solid #dee2e6;
      box-shadow: 2px 0 10px rgba(0,0,0,0.05);
      transition: transform 0.3s ease;
    }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  color: #495057;
  font-weight: 500;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background-color: #e9ecef;
  color: #0d47a1;
}

.sidebar .nav-link i {
  margin-right: 10px;
  font-size: 1.2rem;
}

/* เมนูหลักที่ active */
.sidebar .nav-link.active {
  background-color: #0d47a1;
  color: #fff !important;
}
.sidebar .nav-link.active i {
  color: #fff;
}

/* เมนูย่อย */
.submenu {
  padding-left: 2.2rem;
  margin-top: 0.2rem;
}
.submenu .nav-link {
  font-weight: 400;
  color: #868e96;
  padding: 0.3rem 0;
}

/* เมนูย่อย hover */
.submenu .nav-link:hover {
  color: #0d6efd;
  background-color: transparent !important;
}

/* เมนูย่อย active */
.submenu .nav-link.active {
  color: #0d47a1 !important;
  background-color: #fff;
}


    .main-content {
      flex-grow: 1;
      padding: 2rem;
    }

    /* Responsive Sidebar Overlay */
    @media (max-width: 768px) {
      body {
        flex-direction: column;
      }
      .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        width: auto;
        height: calc(100vh - 56px);
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform 0.3s ease-in-out;
      }
      .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 12px rgba(0,0,0,0.2);
      }
        .sidebar img {
            display: none;
        }
        .sidebar hr {
            display: none;
        }    
      }

    /* Optional: Backdrop for mobile */
    .backdrop {
      display: none;
      position: fixed;
      top: 56px;
      left: 0;
      width: 100%;
      height: calc(100vh - 56px);
      background-color: rgba(0, 0, 0, 0.3);
      z-index: 1049;
    }
    .backdrop.active {
      display: block;
    }
    .card {
      animation: fadeIn 0.5s ease;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(20px); }
      to { opacity: 1; transform: translateY(0); }
    }

/**/
    .sidebar {
      position: fixed;
      top: 0;
      left: 0;
      width: 350px;
      /* ปรับตามของคุณ */
      height: 100vh;
      background: #fff;
      z-index: 1030;
      display: flex;
      flex-direction: column;
    }

    .sidebar-menu {
      flex: 1;
      /* กินพื้นที่ที่เหลือ */
      overflow-y: auto;
      padding-bottom: 1rem;
    }

@media (min-width: 768px) {

  .main-content {
    margin-left: 350px;              /* เท่ากับ sidebar */
    padding: 0 1.5rem;               /* กันชิดขอบ */
    display: flex;
    justify-content: center;         /* ⭐ จัดกลางจริง */
  }
}