@media (max-width: 768px) {
    .header-right, 
    .header-right.mobile-header-flex {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding-left: 20px !important;
        padding-right: 10px !important;
        width: 100%;
        height: 60px;
    }

    .toggle-mobile-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px !important;
        height: 40px !important;
        margin-right: 10px !important;
        cursor: pointer;
        z-index: 9999;
        background: transparent;
    }

    .logo {
        width: auto !important;
        display: flex;
        align-items: center;
        text-decoration: none;
    }
    
    .logo h2 {
        font-size: 16px !important;
        margin: 0;
        color: black;
        white-space: nowrap;
    }
    
    .wrapper {
        width: 100% !important;
        margin: 0;
        padding: 0;
    }

    .hide-on-mobile, .app-nav, .right-nav {
        display: none !important;
    }

    .sidenav {
        height: 100%;
        width: 0;
        position: fixed;
        z-index: 99990; 
        top: 0;
        left: 0;
        background-color: #ffffff;
        overflow-x: hidden;
        transition: 0.3s;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        display: flex;
        flex-direction: column;
    }

    .sidenav.open {
        width: 280px !important; 
    }
    
    .kts-section-inner h3, 
    .dashboard-head h2,
    .dashboard-head h3 {
        text-align: left !important; 
        justify-content: flex-start !important;
        width: 100%;
        display: block;
        padding-left: 5px;
        font-size: 16px !important;
        margin-bottom: 10px;
    }

    .main_outer {
        height: 100vh;
        width: 100vw;
        overflow: hidden;
        background-color: #fdf3f3;
    }

    .main_inner {
        width: 100%;
        height: 100%;
        overflow-y: scroll;
        padding-top: 70px !important;
        padding-bottom: 30px !important;
        display: block !important;
    }

    .container {
        width: 96% !important;
        margin: 0 auto;
        height: auto;
    }

    .footer-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: #fff;
        border-top: 1px solid #e0e0e0;
        z-index: 99999;
        justify-content: space-around;
        align-items: center;
        overflow-x: auto;
    }

    .footer-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #888;
        font-size: 10px;
        flex-shrink: 0;
        padding: 0 10px;
        width: auto;
    }

    .footer-link img {
        width: 22px;
        height: 22px;
        margin-bottom: 3px;
    }

    .footer {
        display: none !important;
    }
    
    .login-page .login-inner .login-form {
        width: 95%;
        padding: 20px;
    }
    
    .kts-table {
        overflow-x: auto;
    }

    #se_region_breakdown_toggle {
        position: relative;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    #se_region_breakdown_toggle .arrow-toggle {
        width: 12px;
        height: 12px;
        border-left: 2px solid #333;
        border-bottom: 2px solid #333;
        transform: rotate(-45deg);
        transition: transform 0.3s;
        margin-right: 15px;
    }

    #se_region_breakdown_toggle.open .arrow-toggle {
        transform: rotate(135deg);
    }

    #se_region_breakdown {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-in-out;
        padding-top: 0;
    }

    #se_region_breakdown.open {
        max-height: 1000px; /* A large enough value to show all content */
        padding-top: 10px;
    }
}

@media (max-width: 768px) {
    .login-page .login-inner .login-form {
        width: 90%;
        max-width: 400px;
        height: auto;
        padding: 30px 20px;
    }

    .login-page .login-inner .login-form h2 {
        font-size: 36px;
    }

    .login-page .login-inner .login-form h3 {
        font-size: 20px;
    }

    nav .nav-inner .logo {
        width: 40%;
    }

    nav .nav-inner .nav-menu {
        display: none;
    }

    nav .nav-inner .nav-mobile {
        display: flex;
        width: 60%;
        justify-content: flex-end;
    }

    .section-inner,.welcome-msg,.widgets {
        width: 95%;
    }

    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-heading .section-buttons {
        margin-top: 10px;
    }

    .popup-menu .poup-menu-inner {
        min-width: 90%;
        width: 90%;
        max-width: 90%;
        padding: 15px;
        margin: 5vh 0;
    }

    .popup-image, .popup-image-bigger {
        display: none;
    }

    .row {
        flex-direction: column;
    }

    .row .column {
        width: 100% !important;
    }

    .main-inner {
        padding-bottom: 60px;
    }

    .widgets {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        padding: 0 15px;
    }

    .widgets .widget {
        width: 100%;
        margin-bottom: 15px;
    }

    .section-inner {
        padding: 0 15px;
    }

    .responsive-table {
        width: 100% !important;
        display: block;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody,
    .responsive-table tfoot {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 6px;
        padding: 8px;
        background: #fff;
    }

    .responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px;
        border-bottom: 1px solid #eee;
        text-align: right;
        white-space: normal;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        text-align: left;
        padding-right: 15px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }
    
    .responsive-table tfoot tr {
        background-color: #f9f9f9;
    }
    
    /* Prevents desktop styling from forcing horizontal scrolling on card layouts */
    .kts-table .responsive-table {
        min-width: 0 !important;
    }

    .kts-table th,
    .kts-table td {
        font-size: 12px;
        padding: 6px;
    }

    .chart-container {
        width: 100%;
        overflow-x: auto;
    }

    canvas {
        width: 100% !important;
        height: auto !important;
    }

    .footer-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #999;
        font-size: 12px;
        flex-grow: 1;
        padding: 5px 0;
    }

    .footer-link img {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
    }

    .footer-link.active {
        color: var(--primary);
    }
}

@media (max-width: 480px) {
    .login-page .login-inner .login-form {
        width: 95%;
        padding: 20px 15px;
    }

    .login-page .login-inner .login-form h2 {
        font-size: 30px;
    }

    .login-page .login-inner .login-form h3 {
        font-size: 18px;
    }

    .login-form img {
        width: 150px;
        height: 60px;
    }

    .notification-inner {
        width: 90%;
        max-width: 90%;
    }
}

.sidenav {
    padding-top: 60px;
}

.sidenav-content {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
}

.sidenav .nav-link {
    padding: 12px 15px;
    text-decoration: none;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.2s, color 0.2s;
}

.sidenav .nav-link:hover {
    background-color: #fceaea;
    color: #c70039;
}

.sidenav .nav-link .icon-logo {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    opacity: 0.6;
}

.sidenav .nav-link:hover .icon-logo {
    opacity: 1;
}

.sidenav .nav-section {
    margin-bottom: 20px;
}

.sidenav .nav-section-title {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    font-weight: bold;
    padding: 0 15px;
    margin-bottom: 10px;
}

.sidenav .logout-link {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    margin: 15px;
    margin-top: auto;
    color: #c70039;
    background-color: #fff;
    border: 1px solid #fceaea;
    flex-shrink: 0;
}

.sidenav .logout-link:hover {
    background-color: #c70039;
    color: white;
}
.sidenav .logout-link:hover .icon-logo {
    opacity: 1;
}

@media (max-width: 768px) {
.toggle-mobile-menu {
    cursor: pointer;
    z-index: 100000;
    padding: 10px;
    display: flex !important;
    flex-direction: column;
    justify-content: center !important;
    align-items: center !important;
    background: transparent !important;
    border: none;
}

.bar1, .bar2, .bar3 {
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 3px 0;
    transition: 0.4s;
    border-radius: 3px;
}

.toggle-mobile-menu.open .bar1 {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.toggle-mobile-menu.open .bar2 {
    opacity: 0;
}

.toggle-mobile-menu.open .bar3 {
    transform: rotate(45deg) translate(-6px, -6px);
}
}

.sidenav-header,
.sidenav .closebtn,
.dropdown-btn,
.dropdown-container,
.sidenav a, .dropdown-btn {
    padding: 0;
    font-size: 0;
    border: none;
    display: none;
}
.sidenav .nav-link,
.sidenav .nav-section-title {
    display: flex;
    font-size: 16px;
    border: none;
}
.sidenav .nav-section-title{
    font-size: 12px;
    display: block;
}


.mobile-logout {
    margin-left: auto;
}

.mobile-logout .icon-logo {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    cursor: pointer;
}

.footer-nav {
    display: none;
}
@media (max-width: 768px) {
    .dashboard-widgets {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-widgets {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kts-dropdown-content {
        position: fixed;
        bottom: 0;
        left: 25px;
        width: 100%;
        height: auto;
        max-height: 80vh;
        background-color: #f9f9f9;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
        z-index: 10000;
        overflow-y: auto;
        display: block !important;
        padding: 10px;
        padding-bottom: 60px;
        box-sizing: border-box;
    }

    .kts-dropdown-content.is-open {
        transform: translateY(0);
    }

    .kts-dropdown.is-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.4);
        z-index: 9999;
    }

    .kts-dropdown-content a {
        display: flex;
        align-items: center;
        padding: 15px;
        font-size: 16px;
        border-radius: 10px;
        margin-bottom: 10px;
        text-decoration: none;
        color: #333;
    }

    .kts-dropdown-content a:hover {
        background-color: #ededed;
    }
    .kts-dropdown-content a:last-child {
        border-bottom: none;
    }

    .kts-dropdown-content a img {
        width: 22px;
        height: 22px;
        margin-right: 15px;
    }
}

@media only screen and (max-width: 1024px) {

  .paymentPopup-inner{
    width: 100%;
    height: 100%;
  }
}

@media only screen and (max-width: 768px) {
  .paymentPopup {
    z-index: 999999;
    height: 100vh;
    width: 100vw;
    
  }

  .paymentPopup-show {
    opacity: 1;
    transform: translateY(0);
  }

  .paymentPopup-inner {
    width: 100%;
    min-width: 100vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
    background-color: white;
    border-radius: 0;
    max-height: 100vh;
    scroll-behavior: smooth;
    padding-bottom: 20%;
  }

  .paymentPopup-inner-content {
    width: 100%;
    padding: 10px;
    background: rgb(248, 248, 248) !important;
    overflow-y: auto;
  }

  .paymentPopup-inner-image {
    width: 100%;
    max-height: 300px;
  }
}

@media (max-width: 768px) {
    .erp-summary-container {
        flex-direction: column;
    }
    .erp-target-remaining {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
    }
    .dashboard-flex-row {
        flex-direction: column;
    }
    .report-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
  #toggleFilterBtn {
    position: fixed;
    bottom: 15%;
    right: 29px;
    background-color: #1d1d1e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    z-index: 1102;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
  }

  .filter-toggle-btn {
    position: fixed;
    bottom: 15%;
    right: 20px;
    background-color: #007bff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    z-index: 1102;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: opacity 0.4s ease;
  }

  .filter-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.5s ease;
  }

  .filter-toggle-btn.active {
    opacity: 0.3;
  }

  .filter-toggle-btn.active .filter-icon {
    transform: rotate(180deg);
  }

  .filter-data {
    position: fixed;
    bottom: 0;
    left: 50%;
    width: 90%;
    background: white;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, 100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1101;
    padding: 16px;
    height: calc(75vh - 80px);
    overflow-y: auto;
    box-sizing: border-box;
    padding-bottom: 100px;
  }

  .filter-data.show {
    transform: translate(-50%, 0);
  }

  .filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
  }

  .filter-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
  }

  .close-btn {
    font-size: 24px;
    cursor: pointer;
    color: #333;
  }

  .filter-data-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .filter-data input,
  .filter-data select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 12px;
    box-sizing: border-box;
  }

  .mobile-only {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-only label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
  }
}

@media screen and (max-width: 992px) {
  .dashboard-widgets {
    display: flex;
    flex-direction: column;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .kts-widget-outer {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-bottom: 15px;
    box-sizing: border-box;
  }
}

@media (min-width: 768px) {
  .container {
    margin-top: 1.5cm;
  }
  .mobile-only-br {
    display: none;
  }
}

@media (min-width: 769px) {
  #toggleFilterBtn,
  .filter-header {
    display: none !important;
  }

  .mobile-only,
  .hide-on-desktop {
    display: none !important;
  }

  .sidenav {
    display: none;
  }

  .filter-data {
    width: auto;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 20px;
    padding: 8px 12px;
    position: fixed;
    top: 70px;
    z-index: 9999;
    background-color: white;
    transform: none !important;
    height: auto;
    overflow: visible;
  }

  .filter-data-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 10px;
  }

  .filter-data input,
  .filter-data select {
    border: none;
    background-color: white;
    color: #333;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 120px;
    text-align: center;
  }

  .filter-data input {
    cursor: text;
  }

  .filter-data input::placeholder {
    color: #999;
    opacity: 0.7;
  }
}
