* {
    font-family: var(--font-primary);
}
/* ==================== DASHBOARD HEADER RESPONSIVE STYLES ==================== */

/* Mobile and Phablet Cleanup */
@media only screen and (max-width: 991px) {
  .dashboard-header {
    margin: 0 0 10px 0 !important;
    padding: 0.4rem 0.8rem !important;
    min-height: 50px !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
  }

  .header-info {
    order: 2 !important;
    flex: 1 !important;
    margin: 0 !important;
  }

  .header-actions-left {
    order: 1 !important;
  }

  .header-actions-right {
    order: 3 !important;
    margin-left: 0 !important;
    gap: 8px !important;
  }

  .user-profile {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
  }

  .user-avatar {
    width: 100% !important;
    height: 100% !important;
  }

  .welcome-text,
  .user-name,
  .page-title {
    display: none !important;
  }

  .icon-only,
  .mobile-menu-btn,
  .landing-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.3rem !important;
  }

  .header-actions-left {
    flex-direction: row-reverse !important;
    gap: 12px !important;
  }

  .page-subtitle {
    font-size: 0.8rem !important;
    padding: 0 8px !important;
    height: 44px !important;
    margin: 0 !important;
    line-height: 44px !important;
  }
}

/* Phablet devices (751px to 768px) */
@media only screen and (min-width: 751px) and (max-width: 768px) {
  .dashboard-header {
    padding: 0.85rem 1.3rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    border-radius: 0 0 15px 15px;
    justify-content: space-between;
  }
  
  .header-actions-left {
    display: flex;
    gap: 8px;
    align-items: center;
    order: 1;
  }
  
  .header-info {
    flex: 1 1 100%;
    text-align: center;
    order: 3;
    margin: 5px 0;
    min-width: 0;
  }
  
  .page-title {
    font-size: 1.25rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .page-subtitle {
    font-size: 0.75rem;
    margin: 2px 0 0 0;
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    min-width: 0;
  }
  
  .user-profile {
    padding: 0.25rem;
    gap: 6px;
    max-width: 180px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.8rem;
    gap: 3px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: inline !important;
  }
  
  .user-name {
    font-size: 0.8rem;
    max-width: 100px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
  
  .time-display {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.75rem;
  }
}

/* Tablet devices (601px to 750px) */
@media only screen and (min-width: 601px) and (max-width: 750px) {
  .dashboard-layout {
    flex-direction: column;
    width: 100%;
    max-width: 100%; /* Prevent layout from overflowing */
    box-sizing: border-box; /* Include padding in width calculation */
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    max-width: 100%; /* Prevent sidebar from overflowing */
    box-sizing: border-box; /* Include padding in width calculation */
  }
  
  .main-content {
    width: 100%;
    max-width: 100%; /* Prevent content from overflowing */
    box-sizing: border-box; /* Include padding in width calculation */
    overflow-x: hidden; /* Prevent horizontal overflow */
  }
  
  .mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    margin: 0;
  }
  
  .mobile-menu-btn:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    right: -260px;
    width: 260px;
    height: 100vh;
    background-color: var(--card-bg);
    box-shadow: none;
    transition: right 0.3s ease;
    z-index: 1000;
    border-radius: 0 0 0 10px;
  }
  
  .sidebar.active {
    right: 0;
  }
  
  .dashboard-header {
    padding: 0.8rem 1.2rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    border-radius: 0 0 15px 15px;
    justify-content: space-between;
  }
  
  .header-actions-left {
    display: flex;
    gap: 8px;
    align-items: center;
    order: 1;
  }
  
  .header-info {
    flex: 1 1 100%;
    text-align: center;
    order: 3;
    margin: 5px 0;
    min-width: 0;
  }
  
  .page-title {
    font-size: 1.2rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .page-subtitle {
    font-size: 0.75rem;
    margin: 2px 0 0 0;
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    min-width: 0;
  }
  
  .user-profile {
    padding: 0.25rem;
    gap: 6px;
    max-width: 170px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.8rem;
    gap: 3px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: inline !important;
  }
  
  .user-name {
    font-size: 0.8rem;
    max-width: 90px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }
  
  .time-display {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.75rem;
  }
}

/* Mobile devices (481px to 600px) */
@media only screen and (min-width: 481px) and (max-width: 600px) {
  .dashboard-header {
    padding: 0.75rem 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    border-radius: 0 0 15px 15px;
    justify-content: space-between;
  }
  
  .header-actions-left {
    display: flex;
    gap: 6px;
    align-items: center;
    order: 1;
  }
  
  .header-info {
    flex: 1 1 100%;
    text-align: center;
    order: 3;
    margin: 4px 0;
    min-width: 0;
  }
  
  .page-title {
    font-size: 1.15rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .page-subtitle {
    font-size: 0.7rem;
    margin: 2px 0 0 0;
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    min-width: 0;
  }
  
  .user-profile {
    padding: 0.2rem;
    gap: 5px;
    max-width: 150px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.75rem;
    gap: 2px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: inline !important;
  }
  
  .user-name {
    font-size: 0.75rem;
    max-width: 80px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.3rem !important;
  }

  .header-actions-left {
    flex-direction: row-reverse !important;
  }
  
  .time-display {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.7rem;
  }
}

/* Small mobile devices (up to 480px) */
@media only screen and (max-width: 480px) {
  .dashboard-header {
    padding: 0.7rem 0.8rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
    border-radius: 0 0 15px 15px;
    justify-content: space-between;
  }
  
  .header-actions-left {
    display: flex;
    gap: 5px;
    align-items: center;
    order: 1;
    min-width: 0;
  }
  
  .header-info {
    flex: 1 1 100%;
    text-align: center;
    order: 3;
    margin: 3px 0;
    min-width: 0;
  }
  
  .page-title {
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .page-subtitle {
    font-size: 0.65rem;
    margin: 2px 0 0 0;
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    min-width: 0;
  }
  
  .user-profile {
    padding: 0.15rem;
    gap: 4px;
    max-width: 130px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.7rem;
    gap: 2px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: inline !important;
  }
  
  .user-name {
    font-size: 0.7rem;
    max-width: 70px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.3rem !important;
  }

  .header-actions-left {
    flex-direction: row-reverse !important;
  }
  
  .time-display {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.65rem;
  }
}

/* Screens under 321px - Hide header info for more space */
@media only screen and (max-width: 320px) {
  .header-info {
    display: none; /* Hide header info on screens under 321px to provide more space for buttons */
  }
  
  .dashboard-header {
    justify-content: center; /* Center the action buttons when header info is hidden */
    padding: 0.5rem 0.5rem; /* Adjust padding */
    flex-direction: column; /* Stack elements vertically */
    align-items: center; /* Center align items */
  }
  
  .header-actions-left,
  .header-actions-right {
    margin: 5px 0; /* Add vertical spacing */
    justify-content: center; /* Center buttons within each section */
  }
  
  .header-actions-left {
    order: 1; /* Order the left actions first */
  }
  
  .header-actions-right {
    order: 2; /* Order the right actions second */
  }
}

/* Very small mobile devices (up to 380px) */
@media only screen and (max-width: 380px) {
  .dashboard-header {
    padding: 0.6rem 0.6rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    border-radius: 0 0 12px 12px;
    justify-content: space-between;
  }
  
  .header-actions-left {
    display: flex;
    gap: 4px;
    align-items: center;
    order: 1;
    min-width: 0;
  }
  
  .header-info {
    flex: 1 1 100%;
    text-align: center;
    order: 3;
    margin: 2px 0;
    min-width: 0;
  }
  
  .page-title {
    font-size: 1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .page-subtitle {
    font-size: 0.6rem;
    margin: 2px 0 0 0;
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    min-width: 0;
  }
  
  .user-profile {
    padding: 0.1rem;
    gap: 3px;
    max-width: 110px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.65rem;
    gap: 2px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: inline !important;
  }
  
  .user-name {
    font-size: 0.65rem;
    max-width: 50px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
  
  .time-display {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.6rem;
  }
}

/* Very small screens approaching 320px - prepare for centered layout */
@media only screen and (max-width: 340px) {
  .header-actions-left,
  .header-actions-right {
    justify-content: center; /* Start centering buttons as screen gets smaller */
  }
}

/* Ultra-small mobile devices (280px to 320px) - Transition to stacked layout */
@media only screen and (min-width: 281px) and (max-width: 320px) {
  .dashboard-header {
    padding: 0.55rem 0.55rem;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border-radius: 0 0 10px 10px;
    justify-content: center;
  }
  
  .header-actions-left {
    display: flex;
    gap: 4px;
    align-items: center;
    order: 1;
    min-width: 0;
    justify-content: center; /* Center buttons */
    width: 100%;
  }
  
  .header-info {
    display: none; /* Hide header info on screens under 321px */
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    justify-content: center; /* Center buttons */
    min-width: 0;
    width: 100%;
  }
  
  .user-profile {
    padding: 0.08rem;
    gap: 2px;
    max-width: 100px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.63rem;
    gap: 2px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: none; /* Hide welcome message on ultra-small screens */
  }
  
  .user-name {
    font-size: 0.63rem;
    max-width: 60px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
  
  .time-display {
    font-size: 0.73rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.58rem;
  }
}

/* Extremely small mobile devices (up to 280px) */
@media only screen and (max-width: 280px) {
  .dashboard-header {
    padding: 0.5rem 0.5rem;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    border-radius: 0 0 10px 10px;
    justify-content: center;
  }
  
  .header-actions-left {
    display: flex;
    gap: 3px;
    align-items: center;
    order: 1;
    min-width: 0;
    flex-shrink: 0;
    justify-content: center; /* Center buttons */
    width: 100%;
  }
  
  .header-info {
    display: none; /* Hide header info on screens under 321px */
  }
  
  .header-actions-right {
    display: flex;
    align-items: center;
    order: 2;
    justify-content: center; /* Center buttons */
    min-width: 0;
    flex-shrink: 0;
    width: 100%;
  }
  
  .user-profile {
    padding: 0.05rem;
    gap: 2px;
    max-width: 100px;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .user-avatar {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  
  .welcome-text {
    font-size: 0.6rem;
    gap: 1px;
    display: flex !important;
    align-items: center;
    white-space: nowrap;
  }
  
  #welcomeMessage {
    display: none; /* Hide welcome message on extremely small screens */
  }
  
  .user-name {
    font-size: 0.6rem;
    max-width: 60px;
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .icon-only, 
  .mobile-menu-btn,
  .landing-btn {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }
  
  .time-display {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
  }
  
  .date-display {
    font-size: 0.55rem;
  }
}

/* Mobile-Safe Container Patterns for screens under 600px */
@media only screen and (max-width: 599px) {
  /* Force all containers to take full width and eliminate desktop-centered thinking */
  .container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 8px; /* Reduce padding to prevent overflow */
    box-sizing: border-box;
  }
  
  /* Ensure main content area takes full width */
  .main-content {
    margin-right: 0;
    width: 100%;
    padding: 0;
  }
  
  /* Make sure dashboard content doesn't overflow */
  .dashboard-content {
    padding: 0.5rem 0.5rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  /* Adjust stat cards for mobile */
  .dashboard-stats {
    grid-template-columns: 1fr; /* Single column on mobile */
    padding: 15px 8px;
    gap: 15px;
  }
  
  /* Adjust table containers to prevent horizontal overflow */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table {
    width: 100%;
    min-width: 600px; /* Allow table to scroll horizontally if needed */
  }
  
  /* Reduce font sizes to prevent overflow */
  .page-title {
    font-size: 1.2rem;
  }
  
  .page-subtitle {
    font-size: 0.7rem;
  }
  
  /* Ensure all elements can shrink properly */
  *, *::before, *::after {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
  
  /* Make sure no elements have fixed widths that cause overflow */
  .card {
    margin-bottom: 15px;
    padding: 15px;
  }
  
  /* Adjust grid layouts to stack vertically */
  .form-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  
  /* Adjust section headers */
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .section-actions {
    width: 100%;
    flex-direction: column;
  }
  
  .search-box {
    width: 100%;
  }
}

/* ==================== END DASHBOARD HEADER RESPONSIVE STYLES ==================== */

/* ==================== AVATAR AND PROFILE SETTINGS RESPONSIVE STYLES ==================== */

/* Tablet devices (601px to 850px) */
@media only screen and (min-width: 601px) and (max-width: 850px) {
  /* Avatar section responsive adjustments */
  .avatar-section {
    align-items: center;
    width: 100%;
  }
  
  .avatar-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .avatar-controls {
    justify-content: center;
    width: 100%;
  }
  
  .avatar-controls .btn {
    flex: 1;
    max-width: 200px;
  }
}

/* Phablet devices (481px to 600px) */
@media only screen and (min-width: 481px) and (max-width: 600px) {
  /* Avatar section responsive adjustments */
  .avatar-section {
    align-items: center;
    width: 100%;
  }
  
  .avatar-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .avatar-image {
    width: 90px;
    height: 90px;
  }
  
  .avatar-controls {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
  }
  
  .avatar-controls .btn {
    width: 100%;
    max-width: 250px;
  }
}

/* Mobile devices (up to 480px) */
@media only screen and (max-width: 480px) {
  /* Avatar section responsive adjustments */
  .avatar-section {
    align-items: center;
    width: 100%;
    gap: 20px;
  }
  
  .avatar-preview {
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }
  
  .avatar-image {
    width: 80px;
    height: 80px;
  }
  
  .avatar-controls {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
  }
  
  .avatar-controls .btn {
    width: 100%;
  }
  
  /* Form adjustments for small screens */
  .form-group {
    margin-bottom: 15px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 15px;
  }
  
  .form-group.col-md-6 {
    width: 100%;
  }
}

/* ==================== END AVATAR AND PROFILE SETTINGS RESPONSIVE STYLES ==================== */



/* Medium devices (tablets, 769px to 991px) */


/* Phablet devices (751px to 768px) */


/* Tablet devices (601px to 750px) */


/* Mobile devices (481px to 600px) */


/* Small mobile devices (up to 480px) */




/* Hide user profile in dashboard header for screens below 850px */
@media only screen and (max-width: 850px) {
  .header-actions-right {
    display: none !important;
  }
  
  .header-info {
    flex: 1;
    text-align: center;
    margin: 0;
  }
  
  .dashboard-header {
    justify-content: space-between;
    padding: 0.8rem 1rem;
  }
  
  .header-actions-left {
    margin-right: 0;
  }
  
  /* Mobile menu overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
  }
  
  .mobile-menu-overlay.active {
    display: block;
  }
}

/* Mobile devices (up to 480px) */
@media only screen and (max-width: 480px) {
  /* Modal footer responsive adjustments for small mobile devices */
  .modal-footer {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }
  
  .modal-footer .btn {
    width: 100%;
    margin: 0;
  }
  
  /* Base options grid responsive adjustments for small mobile devices */
  .base-options-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .base-option-card {
    padding: 12px;
  }
  
  .base-option-title {
    font-size: 0.9rem;
  }
  
  .base-power-button {
    width: 24px;
    height: 24px;
  }
  
  .base-option-input-container .form-input {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  /* Base options review grid responsive adjustments */
  .base-options-review-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .base-option-review-card {
    padding: 10px;
  }
  
  .base-option-review-title {
    font-size: 0.85rem;
  }
  
  /* Dashboard stats responsive adjustments */
  .dashboard-stats {
    grid-template-columns: 1fr;
    padding: 15px;
    gap: 15px;
  }
  
  .stat-card {
    padding: 20px;
    gap: 15px;
  }
  
  .stat-icon {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .stat-title {
    font-size: 15px;
  }
  
  .stat-change {
    font-size: 13px;
  }
  
  .row {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  
  .col-md-12 {
    width: 100%;
    margin-bottom: 0;
  }
  
  .nav-tabs {
    flex-direction: column;
    border-bottom: none;
    gap: 8px;
    margin-top: 20px; /* افزایش فاصله تب‌ها از هدر */
  }
  
  .nav-item {
    margin-bottom: 5px;
    width: 100%;
  }
  
  .nav-link {
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    text-align: center;
  }
  
  .nav-link.active {
    border-bottom-color: #dee2e6;
  }
  
  .tab-content {
    margin-top: 15px;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .card-text {
    font-size: 0.9rem;
  }
  
  .btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  
  .d-flex {
    flex-direction: column;
    gap: 10px;
  }
  
  .justify-content-between {
    justify-content: center;
  }
  
  .align-items-center {
    align-items: flex-start;
  }
  
  .mb-3 {
    margin-bottom: 15px;
  }
  
  .alert {
    padding: 10px;
    font-size: 0.85rem;
  }
  
  /* Device slot packages responsive adjustments */

  

  

  
  .package-name {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .package-price {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
  
  .package-details {
    margin-bottom: 1.5rem;
  }
  
  .package-feature {
    margin-bottom: 0.75rem;
    padding: 0.4rem;
  }
  
  .feature-icon {
    font-size: 1rem;
    margin-left: 0.5rem;
  }
  
  .feature-text {
    font-size: 1rem;
  }
  
  .package-description {
    font-size: 0.9rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
  }
  

  

  

  

  
  .plan-medal {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
  }
  

  
  .plan-price {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }
  
  .plan-details {
    margin-bottom: 1.5rem;
  }
  
  .plan-feature {
    margin-bottom: 0.75rem;
    padding: 0.4rem;
  }
  
  .feature-icon {
    font-size: 1rem;
    margin-left: 0.5rem;
  }
  
  .feature-text {
    font-size: 1rem;
  }
  
  .select-plan-btn {
    padding: 0.8rem;
    font-size: 1rem;
    border-radius: 0.5rem;
  }
  
  /* Mobile menu overlay */
  .mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
  }
  
  .mobile-menu-overlay.active {
    display: block;
  }
}

/* Comprehensive responsive fix for screens under 600px */
@media only screen and (max-width: 599px) {
  /* Reset container behavior */
  .container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 8px;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  /* Dashboard layout fixes */
  .dashboard-layout {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  .main-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  /* Dashboard header responsive */
  .dashboard-header {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 0.5rem;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  /* Dashboard content responsive */
  .dashboard-content {
    padding: 0.5rem 0.5rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Banners container responsive */
  #dashboardBannersSection .banners-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Banner card responsive */
  #dashboardBannersSection .banner-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Stats section responsive */
  .dashboard-stats {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 15px 8px !important;
    gap: 15px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Stat card responsive */
  .stat-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Alert card responsive */
  .alert {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Section title responsive */
  #dashboardBannersSection .section-title {
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px auto !important;
    padding: 15px !important;
    font-size: 1.2rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* General responsive fixes */
  .card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: auto !important;
  }
  
  /* Prevent any overflow */
  *, *::before, *::after {
    box-sizing: border-box !important;
    max-width: 100% !important;
  }
  
  /* Form elements */
  .form-row {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    box-sizing: border-box !important;
  }
  
  /* Grid adjustments */

}

/* Phablet devices (481px to 600px) */
@media only screen and (min-width: 481px) and (max-width: 600px) {
  /* Modal footer responsive adjustments for phablets */
  .modal-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
  
  .modal-footer .btn {
    width: auto;
    margin: 0;
  }
  
  /* Base options grid responsive adjustments for phablets */
  .base-options-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }
  
  .base-option-card {
    padding: 12px;
  }
  
  .base-option-input-container .form-input {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  
  /* Base options review grid responsive adjustments */
  .base-options-review-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }
  
  .row {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  .col-md-12 {
    width: 100%;
    margin-bottom: 0;
  }
  
  .nav-tabs {
    flex-wrap: wrap;
  }
  
  .nav-item {
    flex: 1 1 auto;
    min-width: 45%;
  }
  
  .d-flex {
    flex-direction: column;
    gap: 15px;
  }
  
  /* Device slot packages responsive adjustments */

  

  
  /* Dashboard content responsive fixes for phablet range */
  .dashboard-content {
    padding: 0.5rem 0.5rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Banners container responsive */
  #dashboardBannersSection .banners-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Banner card responsive */
  #dashboardBannersSection .banner-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Stats section responsive */
  .dashboard-stats {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 15px 8px !important;
    gap: 15px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Stat card responsive */
  .stat-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Alert card responsive */
  .alert {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto 15px auto !important;
    padding: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  
  /* Section title responsive */
  #dashboardBannersSection .section-title {
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px auto !important;
    padding: 15px !important;
    font-size: 1.3rem !important;
    text-align: center !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
}

/* Tablet devices (601px to 850px) */
@media only screen and (min-width: 601px) and (max-width: 850px) {
  /* Modal footer responsive adjustments for tablets */
  .modal-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
  
  .modal-footer .btn {
    width: auto;
    margin: 0;
  }
  
  /* Base options grid responsive adjustments for tablets */
  .base-options-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  
  /* Base options review grid responsive adjustments */
  .base-options-review-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
  }
  
  .row {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  
  .col-md-12 {
    width: 100%;
    margin-bottom: 0;
  }
  
  .nav-item {
    flex: 1 1 auto;
    min-width: 45%;
  }
  
  .d-flex {
    flex-wrap: wrap;
  }
  
  .justify-content-between {
    justify-content: center;
  }
  
  .align-items-center {
    align-items: flex-start;
  }
  
  /* Device slot packages responsive adjustments */

  

}

/* ==================== BOTTOM NAVIGATION & BOTTOM SHEET (MOBILE + TABLET / LANDSCAPE PHONE) ====================
   Sidebar + hamburger are desktop-only (>1024px). Everything at or below that —
   phone portrait, phone landscape, and tablet — gets the bottom nav shell instead. */
@media only screen and (max-width: 1024px) {
  /* Hide Header and Sidebar outside desktop */
  .dashboard-header,
  .sidebar,
  .mobile-menu-overlay,
  .mobile-menu-btn {
    display: none !important;
  }

  /* Adjust Main Content for Bottom Nav */
  .main-content {
    margin-right: 0 !important;
    padding-bottom: 70px !important; /* Space for bottom nav */
    height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }

  .dashboard-content {
    padding: 15px !important;
  }

  /* Bottom Navigation Styling */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid var(--border-color);
    z-index: 1000;
    padding: 0 5px;
    box-shadow: none;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 4px;
    position: relative;
  }

  .bottom-nav-item i {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
  }

  .bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
  }

  .bottom-nav-item.active {
    color: var(--accent-color);
  }

  .bottom-nav-item.active i {
    transform: translateY(-2px);
  }

  .bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: -12px;
    width: 20px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 0 0 4px 4px;
  }

  /* Unread-notifications dot on the bottom-nav bell icon */
  .bottom-nav-item__badge {
    position: absolute;
    top: 2px;
    right: 50%;
    margin-right: -14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--danger-color, #ef4444);
    border: 1.5px solid var(--card-bg);
  }

  /* Bottom Sheet Styling */
  .bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0.3s;
  }

  .bottom-sheet.active {
    visibility: visible;
    pointer-events: auto;
  }

  .bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .bottom-sheet.active .bottom-sheet-overlay {
    opacity: 1;
  }

  .bottom-sheet-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    /* iOS-like spring easing for a smooth, native-feeling slide */
    transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
    padding: 15px 20px 30px;
    max-height: 85vh;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    touch-action: pan-y;
    will-change: transform;
  }

  .bottom-sheet.active .bottom-sheet-content {
    transform: translateY(0);
  }

  /* Grabbable handle — larger tap zone and a clear affordance */
  .bottom-sheet-handle {
    width: 44px;
    height: 5px;
    background-color: var(--border-color);
    border-radius: 3px;
    margin: 0 auto 15px;
    cursor: grab;
    transition: background-color 0.2s ease;
  }
  .bottom-sheet-content:active .bottom-sheet-handle {
    background-color: var(--text-muted);
  }

  .bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .bottom-sheet-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
  }

  .bottom-sheet-close {
    background-color: var(--hover-bg);
    border: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }

  .bottom-sheet-close:active {
    transform: scale(0.9);
    background-color: var(--border-color);
  }

  /* Sheet Groups Styling */
  .sheet-group {
    margin-bottom: 25px;
  }

  .sheet-group-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
    padding-right: 5px;
  }

  /* Quick Actions Grid */
  .quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .quick-action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background-color: var(--hover-bg);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
  }

  .quick-action-item:active {
    transform: scale(0.98);
    background-color: var(--border-color-light);
  }

  .action-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--accent-color);
    box-shadow: none;
  }

  .quick-action-item span {
    font-size: 0.85rem;
    font-weight: 500;
  }

  /* More Grid Adjustments */
  .more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 5px;
    border-radius: 12px;
    background-color: var(--hover-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
  }

  .more-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background-color: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--accent-color);
    box-shadow: none;
  }

  .more-item span {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
  }

  /* Logout Button Mobile */
  .logout-btn-mobile {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(var(--error-base-rgb, 165, 37, 34), 0.2);
    background-color: rgba(var(--error-base-rgb, 165, 37, 34), 0.05);
    color: var(--error-base);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .logout-btn-mobile:active {
    transform: scale(0.98);
    background-color: rgba(var(--error-base-rgb, 165, 37, 34), 0.1);
  }

  .logout-btn-mobile i {
    font-size: 1.1rem;
  }

  /* ==================== MOBILE OPTIMIZED NOTIFICATIONS ==================== */
  #notificationContainer {
    top: 15px !important;
    right: 15px !important;
    left: 15px !important;
    bottom: auto !important;
    align-items: center !important;
    max-width: none !important;
    padding: 0 !important;
    gap: 8px !important;
  }

  .notification {
    width: 100% !important;
    max-width: 450px !important;
    min-width: 0 !important;
    padding: 14px 18px !important;
    border-radius: 12px !important;
    font-size: 0.85rem !important;
    margin: 0 auto !important;
    box-shadow: none;
    transform: translateY(-20px) scale(0.95) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  .notification.show {
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
  }

  .notification.fade-out {
    opacity: 0 !important;
    transform: translateY(-20px) scale(0.95) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-bottom: -60px !important; /* Smoothly collapse space */
  }

  .notif-close {
    margin-right: auto !important;
    opacity: 0.6 !important;
    cursor: pointer !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.05) !important;
    flex-shrink: 0 !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
  }

  .notif-close i {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    line-height: 1 !important;
  }

  .notif-close:active, .notif-close:hover {
    transform: scale(0.9) !important;
    background: rgba(0, 0, 0, 0.1) !important;
    opacity: 1 !important;
  }

  /* Progress Bar Styling */
  .notif-progress {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 4px !important;
    width: 100% !important;
    transform-origin: left !important;
    z-index: 10 !important;
  }

  .notification.success .notif-progress { background: #10b981 !important; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4) !important; }
  .notification.error .notif-progress { background: #ef4444 !important; box-shadow: 0 0 6px rgba(239, 68, 68, 0.4) !important; }
  .notification.warning .notif-progress { background: #f59e0b !important; box-shadow: 0 0 6px rgba(245, 158, 11, 0.4) !important; }
  .notification.info .notif-progress { background: #3b82f6 !important; box-shadow: 0 0 6px rgba(59, 130, 246, 0.4) !important; }

  /* Track for mobile */
  .notification::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 4px !important;
    background: rgba(0, 0, 0, 0.1) !important;
    z-index: 9 !important;
  }

  /* ==================== MOBILE OPTIMIZED REMINDER TOAST ==================== */
  .reminder-due-toast {
    bottom: 85px !important; /* Above Bottom Navigation (65px + 20px safe distance) */
    left: 15px !important;
    right: 15px !important;
    top: auto !important;
    max-width: none !important;
    gap: 8px !important;
  }

  .reminder-due-toast-item {
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    background: var(--card-bg) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-right: 3px solid var(--error-base) !important;
    box-shadow: none;
    animation: mobile-toast-in 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
    transition: all 0.3s ease !important;
  }

  .reminder-due-toast-item.toast-exit {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    margin-bottom: -70px !important; /* Collapse space smoothly */
    animation: none !important;
  }

  @keyframes mobile-toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .rdt-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
  }

  .rdt-title {
    font-size: 0.8rem !important;
    margin-bottom: 0 !important;
    color: var(--text-primary) !important;
  }

  .rdt-time {
    font-size: 0.7rem !important;
    color: var(--error-base) !important;
  }

  .rdt-close {
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--hover-bg) !important;
    border-radius: 50% !important;
    font-size: 0.8rem !important;
    color: var(--text-secondary) !important;
    margin-top: 0 !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    border: none !important;
    flex-shrink: 0 !important;
  }

  .rdt-close i {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    line-height: 1 !important;
  }

  .rdt-close:active, .rdt-close:hover {
    background: var(--border-color) !important;
    transform: scale(0.9) !important;
    color: var(--text-primary) !important;
  }

  /* Mobile data tables: the wrapper must NOT impose its own card frame or
     horizontal scroll once each row becomes its own stacked card — otherwise
     the table overflows to the left and content is clipped. */
  .table-responsive-modern {
    overflow-x: visible !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin-top: 15px !important;
  }

  .data-table-modern,
  .data-table-modern thead,
  .data-table-modern tbody, 
  .data-table-modern tr, 
  .data-table-modern td {
    display: block !important;
    width: 100% !important;
  }

  .data-table-modern thead {
    display: none !important;
  }

  .data-table-modern tr {
    margin-bottom: 14px !important;
    background: var(--card-bg) !important;
    border-radius: 14px !important;
    padding: 6px 16px !important;
    box-shadow: none !important;
    border: 1px solid var(--border-color) !important;
    box-sizing: border-box !important;
    overflow: hidden !important; /* Ensure nothing sticks out */
    width: 100% !important;
  }

  /* Field rows: label stacked ABOVE the value (not side-by-side) — a fixed
     80px label column squeezed long/badge-heavy values (like footer-notes
     "متن") into a narrow strip and made everything read as one cramped
     line. Stacking gives every value the full card width and lets the
     label read as a small caption instead of fighting the value for space. */
  .data-table-modern td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid var(--border-color-light) !important;
    text-align: right !important;
    font-size: 0.8rem !important;
    gap: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  .data-table-modern td:last-child {
    border-bottom: none !important;
    padding-top: 12px !important;
    padding-bottom: 10px !important;
  }

  .data-table-modern td::before {
    content: attr(data-label);
    font-weight: 700 !important;
    color: var(--accent-color) !important;
    font-size: 0.66rem !important;
    letter-spacing: 0.02em;
    white-space: nowrap !important;
    text-align: right !important;
    opacity: 0.75;
  }

  .data-table-modern td > * {
    width: 100% !important;
    text-align: right !important;
    font-size: 0.8rem !important;
    word-break: break-word !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Action row (عملیات — always the last td): its own footer band, visually
     split from the field list above instead of just another stacked field. */
  .data-table-modern td:last-child::before {
    display: none !important;
  }

  .data-table-modern td:last-child > * {
    width: auto !important;
  }

  /* No-records placeholder cell: center it as a single block. */
  .data-table-modern tbody tr td[colspan] {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .data-table-modern tbody tr td[colspan]::before {
    display: none !important;
  }

  .data-table-modern tbody tr td[colspan] > * {
    max-width: 100% !important;
    text-align: center !important;
  }

  /* Specific fix for footer note preview in mobile cards */
  .footer-note-text-preview {
    width: 100% !important;
    line-height: 1.6 !important;
    display: inline-block !important;
  }

  /* Action buttons in stacked table cards — sized for touch (min 44px). */
  .btn-action-modern {
    width: 44px !important;
    height: 44px !important;
    font-size: 0.95rem !important;
  }

  .table-actions {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important; /* Align buttons to the left */
    align-items: center !important;
    width: auto !important; /* Don't take full width */
    gap: 10px !important;
    flex-wrap: wrap !important; /* Wrap instead of overflowing on tiny phones */
  }
}

/* Ensure real desktop (>1024px) still works correctly */
@media only screen and (min-width: 1025px) {
  .bottom-nav,
  .bottom-sheet {
    display: none !important;
  }
}

/* ==================== SMALL DESKTOP & TABLET OPTIMIZATIONS (769px to 1280px) ==================== */
@media only screen and (min-width: 769px) and (max-width: 1280px) {
  /* Home Section Scaling */
  .banners-column {
    flex: 0 0 58% !important; /* Adjust percentage for banners */
    min-width: 0 !important;
  }

  .recent-proposals-column {
    flex: 0 0 58% !important; /* Adjust percentage for proposals */
    min-width: 0 !important;
  }

  /* Stat Cards Scaling - Use smaller fonts and padding */
  .stat-card {
    padding: 16px 12px !important;
    min-height: 150px !important;
    border-radius: 20px !important;
  }

  .stat-icon {
    width: 48px !important;
    height: 48px !important;
    margin-bottom: 10px !important;
    border-radius: 14px !important;
  }

  .stat-icon i {
    font-size: 1.3rem !important;
  }

  .stat-value {
    font-size: 1.6rem !important;
    letter-spacing: -0.5px !important;
  }

  .stat-title {
    font-size: 0.72rem !important;
    margin-bottom: 4px !important;
  }

  .stat-change {
    font-size: 0.65rem !important;
    margin-top: 10px !important;
    padding: 3px 8px !important;
  }











  .stat-info {
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* Force Stacking earlier if columns are still too tight */
@media only screen and (min-width: 769px) and (max-width: 1080px) {
  .banners-column,
.recent-proposals-column,
.stats-column {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }

  .home-top-row,
  .home-bottom-row {
    flex-direction: column !important;
    gap: 20px !important;
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .recent-proposals-card {
    max-width: 100% !important;
  }
}

/* ════════════════════════════════════════════════════════════
   Mobile Bottom-Sheet — refreshed skin, session/version frame,
   and smoother iOS-style motion (token-only).
   ════════════════════════════════════════════════════════════ */
@media only screen and (max-width: 1024px) {
  /* Softer, deeper sheet entrance */
  .bottom-sheet-content {
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1) !important;
    box-shadow: none;
  }

  .bottom-sheet-overlay {
    transition: opacity 0.42s ease !important;
  }

  .bottom-sheet-handle {
    cursor: grab;
  }

  /* Staggered reveal of each group as the sheet opens */
  .bottom-sheet .sheet-group {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .bottom-sheet.active .sheet-group {
    opacity: 1;
    transform: translateY(0);
  }

  .bottom-sheet.active .sheet-group:nth-child(1) { transition-delay: 0.05s; }
  .bottom-sheet.active .sheet-group:nth-child(2) { transition-delay: 0.11s; }
  .bottom-sheet.active .sheet-group:nth-child(3) { transition-delay: 0.17s; }
  .bottom-sheet.active .sheet-group:nth-child(4) { transition-delay: 0.23s; }

  /* System status (session + version) cards */
  .sheet-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .sheet-info-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(var(--accent-rgb), 0.06);
    border: 1px solid rgba(var(--accent-rgb), 0.12);
    transition: transform var(--transition), background var(--transition);
    min-width: 0;
  }

  .sheet-info-card:active {
    transform: scale(0.98);
    background: rgba(var(--accent-rgb), 0.1);
  }

  .sheet-info-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent-color);
    font-size: 1rem;
  }

  .sheet-info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .sheet-info-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
  }

  .sheet-info-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sheet-info-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.4;
  }
}

/* Respect reduced-motion: no slide/stagger, just appear */
@media only screen and (max-width: 1024px) and (prefers-reduced-motion: reduce) {
  .bottom-sheet .sheet-group {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .bottom-sheet-content {
    transition: none !important;
  }
}
